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:
authorEric Maupin <ermaup@microsoft.com>2018-08-17 23:31:27 +0300
committerEric Maupin <ermaup@microsoft.com>2018-10-17 22:12:52 +0300
commit017d4d85fc75bd77cfabdc9536f007695cfcf8b2 (patch)
treef0e5c9f209243f7e94d16b8e5fd7d18992959d32 /Xamarin.PropertyEditing.Windows
parent41bb09e03bc5fc9cfdeb1a2d5bcf1008c7064190 (diff)
[Core/Win] CreateVariant
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r--Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml49
-rw-r--r--Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml.cs43
-rw-r--r--Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj7
3 files changed, 99 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml b/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml
new file mode 100644
index 0000000..4bb5167
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/CreateVariantWindow.xaml
@@ -0,0 +1,49 @@
+<local:WindowEx x:Class="Xamarin.PropertyEditing.Windows.CreateVariantWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="clr-namespace:Xamarin.PropertyEditing.Windows"
+ xmlns:prop="clr-namespace:Xamarin.PropertyEditing.Properties;assembly=Xamarin.PropertyEditing"
+ xmlns:vms="clr-namespace:Xamarin.PropertyEditing.ViewModels;assembly=Xamarin.PropertyEditing"
+ mc:Ignorable="d" x:ClassModifier="internal"
+ Background="{DynamicResource DialogBackgroundBrush}" Foreground="{DynamicResource DialogForegroundBrush}"
+ ShowMaximize="False" ShowIcon="False" ShowMinimize="False" WindowStartupLocation="CenterOwner"
+ Title="{x:Static prop:Resources.AddVariationTitle}" SizeToContent="Height"
+ Width="450">
+ <Window.Resources>
+ <ResourceDictionary Source="Themes/DialogResources.xaml" />
+ </Window.Resources>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <TextBlock Grid.Row="0" Text="{x:Static prop:Resources.AddVariationHelpText}" Margin="12,12,12,0" />
+
+ <Border Grid.Row="1" Margin="0,12,0,0" Padding="12,0,12,0">
+ <ItemsControl ItemsSource="{Binding VariationCategories,Mode=OneTime}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="vms:VariationViewModel">
+ <Grid Margin="12,4,12,4">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="30*" />
+ <ColumnDefinition Width="70*" />
+ </Grid.ColumnDefinitions>
+
+ <TextBlock Grid.Column="0" Text="{Binding Name,Mode=OneTime}" />
+ <ComboBox Grid.Column="1" ItemsSource="{Binding Variations,Mode=OneTime}" SelectedItem="{Binding SelectedVariation,Mode=TwoWay}" DisplayMemberPath="Name" />
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Border>
+
+ <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="12">
+ <Button Name="ok" MinHeight="23" MinWidth="75" Content="{x:Static prop:Resources.OK}" IsDefault="True" Command="{Binding CreateVariantCommand,Mode=OneTime}" Click="OnOkClicked" />
+ <Button MinHeight="23" MinWidth="75" Margin="4,0,0,0" Content="{x:Static prop:Resources.Cancel}" IsCancel="True" Click="OnCancelClicked" />
+ </StackPanel>
+ </Grid>
+</local:WindowEx>
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;
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
index 0f9563f..6f259d5 100644
--- a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
+++ b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
@@ -88,6 +88,9 @@
<Compile Include="CreateResourceWindow.xaml.cs">
<DependentUpon>CreateResourceWindow.xaml</DependentUpon>
</Compile>
+ <Compile Include="CreateVariantWindow.xaml.cs">
+ <DependentUpon>CreateVariantWindow.xaml</DependentUpon>
+ </Compile>
<Compile Include="DoubleToAngleConverter.cs" />
<Compile Include="CreateValueConverterWindow.xaml.cs">
<DependentUpon>CreateValueConverterWindow.xaml</DependentUpon>
@@ -165,6 +168,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="CreateVariantWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="ResourceSelectorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>