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

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs')
-rw-r--r--Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs b/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs
new file mode 100644
index 0000000..dae1823
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs
@@ -0,0 +1,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 PropertyVariationSet 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.Variant;
+ }
+
+ private void OnOkClicked (object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ }
+
+ private void OnCancelClicked (object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ }
+ }
+}