blob: 5a3479448bff7f2358a8abed7ff8f9662a0a8f26 (
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.Collections.Generic;
using System.Linq;
using System.Windows;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Windows
{
internal partial class CreateVariantWindow
: WindowEx
{
public CreateVariantWindow (IEnumerable<ResourceDictionary> merged, IPropertyInfo property)
{
DataContext = new CreateVariantViewModel (property);
InitializeComponent ();
Resources.MergedDictionaries.AddItems (merged);
}
internal static PropertyVariation RequestVariant (FrameworkElement owner, IPropertyInfo property)
{
Window hostWindow = Window.GetWindow (owner);
var w = new CreateVariantWindow (owner.Resources.MergedDictionaries, property) {
Owner = hostWindow,
};
if (!w.ShowDialog () ?? false)
return null;
var vm = (CreateVariantViewModel)w.DataContext;
return vm.Variation;
}
private void OnOkClicked (object sender, RoutedEventArgs e)
{
DialogResult = true;
}
private void OnCancelClicked (object sender, RoutedEventArgs e)
{
DialogResult = false;
}
}
}
|