blob: 965ac0de4bd14f0ed3e5a6d0803859a611479ba7 (
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
44
45
46
47
48
49
50
51
52
|
using System;
using System.ComponentModel;
using CoreGraphics;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Mac
{
class SolidColorBrushEditorViewController : NotifyingViewController<BrushPropertyViewModel>
{
private SolidColorBrushEditor brushEditor;
public SolidColorBrushEditorViewController ()
{
PreferredContentSize = new CGSize (300, 230);
}
public override void OnPropertyChanged (object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName) {
case nameof (BrushPropertyViewModel.Solid):
if (this.brushEditor != null)
this.brushEditor.ViewModel = ViewModel.Solid;
break;
case nameof (BrushPropertyViewModel.Value):
if (this.brushEditor != null)
this.brushEditor.ViewModel = ViewModel.Solid;
break;
}
}
public override void OnViewModelChanged (BrushPropertyViewModel oldModel)
{
if (this.brushEditor != null)
this.brushEditor.ViewModel = ViewModel?.Solid;
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
if (ViewModel != null)
this.brushEditor.ViewModel = ViewModel?.Solid;
}
public override void LoadView ()
{
View = this.brushEditor = new SolidColorBrushEditor {
ViewModel = ViewModel?.Solid
};
}
}
}
|