Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MaterialBrushEditorViewController.cs « Custom « Controls « Xamarin.PropertyEditing.Mac - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 933eeef4bc3550fe9b980490fdd8fa96c26cf28b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.ComponentModel;
using System.Linq;
using AppKit;
using CoreGraphics;
using Xamarin.PropertyEditing.ViewModels;

namespace Xamarin.PropertyEditing.Mac
{
	class MaterialBrushEditorViewController : NotifyingViewController<BrushPropertyViewModel>
	{
		public MaterialBrushEditorViewController ()
		{
			PreferredContentSize = new CGSize (200, 230);
		}

		private MaterialView materialEditor;

		public override void OnPropertyChanged (object sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName) {
				case nameof (BrushPropertyViewModel.Value):
				case nameof (BrushPropertyViewModel.MaterialDesign):
					if (this.materialEditor != null)
						this.materialEditor.ViewModel = ViewModel;
					break;
			}
		}

		public override void OnViewModelChanged (BrushPropertyViewModel oldModel)
		{
			if (ViewLoaded && materialEditor != null)
				this.materialEditor.ViewModel = ViewModel;
		}

		public override void LoadView ()
		{
			View = materialEditor = new MaterialView {
				ViewModel = ViewModel
			};
		}
	}
}