blob: eec3c449603354a22243bf3cd6c0d36af931c2d2 (
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
|
using System.Windows;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Windows
{
internal class ObjectEditorControl
: PropertyEditorControl
{
static ObjectEditorControl()
{
DefaultStyleKeyProperty.OverrideMetadata (typeof(ObjectEditorControl), new FrameworkPropertyMetadata (typeof(ObjectEditorControl)));
}
public ObjectEditorControl()
{
DataContextChanged += OnDataContextChanged;
}
private ObjectPropertyViewModel vm;
private void OnDataContextChanged (object sender, DependencyPropertyChangedEventArgs e)
{
if (this.vm != null)
this.vm.TypeRequested -= OnTypeRequested;
this.vm = e.NewValue as ObjectPropertyViewModel;
if (this.vm != null)
this.vm.TypeRequested += OnTypeRequested;
}
private void OnTypeRequested (object sender, TypeRequestedEventArgs e)
{
var vsender = (ObjectPropertyViewModel)sender;
var panel = this.FindPropertiesHost ();
ITypeInfo type = TypeSelectorWindow.RequestType (panel, vsender.AssignableTypes);
e.SelectedType = type;
}
}
}
|