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

CreateBindingWindow.xaml « Xamarin.PropertyEditing.Windows - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d233dc4716a11b229723cdee9a2340cf3319ae02 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<local:WindowEx x:Class="Xamarin.PropertyEditing.Windows.CreateBindingWindow"
		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}"
		MinWidth="400" MinHeight="400" Width="600" Height="600" ShowMaximize="False" ShowMinimize="False" ShowIcon="False" WindowStartupLocation="CenterOwner"
		Title="{Binding PropertyDisplay}">
	<local:WindowEx.Resources>
		<ResourceDictionary>
			<local:InvertedVisibilityConverter x:Key="InvertedVisibilityConverter" />

			<Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ToggleButton}">
							<Border Padding="{TemplateBinding Padding}">
								<Grid Background="Transparent" SnapsToDevicePixels="False">
									<Path x:Name="arrow" Data="M0,0 L0,6 L6,0 z" HorizontalAlignment="Left" Width="11" Height="11" SnapsToDevicePixels="True" Stroke="{DynamicResource TreeViewItem.TreeArrow.Static.Stroke}" StrokeThickness="1" VerticalAlignment="Bottom">
										<Path.RenderTransform>
											<RotateTransform Angle="135" CenterY="3" CenterX="3" />
										</Path.RenderTransform>
									</Path>
									<ContentPresenter HorizontalAlignment="Left" Margin="13,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center" />
								</Grid>
							</Border>
							<ControlTemplate.Triggers>
								<Trigger Property="IsChecked" Value="True">
									<Setter Property="RenderTransform" TargetName="arrow">
										<Setter.Value>
											<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
										</Setter.Value>
									</Setter>
									<Setter Property="Fill" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
									<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
								</Trigger>
								<Trigger Property="IsMouseOver" Value="True">
									<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
									<Setter Property="Fill" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
								</Trigger>
								<MultiTrigger>
									<MultiTrigger.Conditions>
										<Condition Property="IsMouseOver" Value="True"/>
										<Condition Property="IsChecked" Value="True"/>
									</MultiTrigger.Conditions>
									<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
									<Setter Property="Fill" TargetName="arrow" Value="{DynamicResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
								</MultiTrigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>

			<Style x:Key="MoreSettings" TargetType="{x:Type Expander}">
				<Setter Property="Foreground" Value="{DynamicResource DialogForegroundBrush}"/>
				<Setter Property="Background" Value="Transparent"/>
				<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
				<Setter Property="VerticalContentAlignment" Value="Stretch"/>
				<Setter Property="BorderBrush" Value="Transparent"/>
				<Setter Property="BorderThickness" Value="1"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type Expander}">
							<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
								<DockPanel>
									<ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{DynamicResource GenericVisualFocusStyle}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
									<ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
								</DockPanel>
							</Border>
							<ControlTemplate.Triggers>
								<Trigger Property="IsExpanded" Value="true">
									<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
								</Trigger>
								<Trigger Property="IsEnabled" Value="false">
									<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
								</Trigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>

			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Themes/DialogResources.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</local:WindowEx.Resources>

	<Grid Margin="12">
		<Grid.ColumnDefinitions>
			<ColumnDefinition />
			<ColumnDefinition Width="10" />
			<ColumnDefinition />
		</Grid.ColumnDefinitions>

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<TextBlock Grid.Row="0" Text="{x:Static prop:Resources.BindingType}" />
		<ComboBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding BindingSources.Value}" SelectedItem="{Binding SelectedBindingSource,Mode=TwoWay}" DisplayMemberPath="Name" Margin="0,4,0,0" />

		<TextBlock Grid.Row="2" Margin="0,8,0,0" Text="{Binding SelectedBindingSource.Description}" Visibility="{Binding ElementName=longDescription,Path=Visibility,Converter={StaticResource InvertedVisibilityConverter}}" />

		<TextBlock Grid.Row="2" Grid.Column="2" Margin="0,8,0,0" Text="{x:Static prop:Resources.Path}" />
		<CheckBox Name="content" Grid.Row="2" Grid.Column="2" Margin="0,8,0,0" HorizontalAlignment="Right" Content="{x:Static prop:Resources.Custom}" Foreground="{DynamicResource DialogForegroundBrush}" />

		<local:TextBoxEx Grid.Row="3" Grid.Column="2" VerticalAlignment="Top" Margin="0,4,0,4" Visibility="{Binding ElementName=content,Path=IsChecked,Converter={StaticResource BoolToVisibilityConverter}}" Text="{Binding Path,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />

		<TextBlock Name="longDescription" Grid.Row="3" Grid.RowSpan="2" Grid.Column="0" VerticalAlignment="Stretch" Text="{Binding SelectedBindingSource.Description}" Visibility="{Binding ShowLongDescription,Converter={StaticResource BoolToVisibilityConverter}}" />
		<local:TreeViewEx Grid.Row="3" Grid.RowSpan="2" Grid.Column="0" Margin="0,4,0,0" Style="{DynamicResource SelectionTreeView}" ItemsSource="{Binding ObjectElementRoots.Value}" DisplayMemberPath="Name.Value" Visibility="{Binding ShowObjectSelector,Converter={StaticResource BoolToVisibilityConverter}}" />
		<local:TreeViewEx Grid.Row="3" Grid.RowSpan="2" Grid.Column="0" Margin="0,4,0,0" Style="{DynamicResource AutoExpandSelectionTreeView}" ItemsSource="{Binding SourceResources.Value}" Visibility="{Binding ShowResourceSelector,Converter={StaticResource BoolToVisibilityConverter}}" SelectedDataItem="{Binding SelectedResource,Mode=TwoWay}">
			<local:TreeViewEx.ItemTemplate>
				<HierarchicalDataTemplate ItemsSource="{Binding Mode=OneTime}">
					<HierarchicalDataTemplate.ItemTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding Name,Mode=OneTime}" />
						</DataTemplate>
					</HierarchicalDataTemplate.ItemTemplate>
					<TextBlock Text="{Binding Key.Name,Mode=OneTime}" />
				</HierarchicalDataTemplate>
			</local:TreeViewEx.ItemTemplate>
		</local:TreeViewEx>
		<local:TypeSelectorControl Grid.Row="3" Grid.RowSpan="2" Grid.Column="0" Margin="0,4,0,0" Visibility="{Binding DataContext.ShowTypeSelector,Converter={StaticResource BoolToVisibilityConverter},ElementName=propertiesTree}" ShowTypeLevel="{Binding DataContext.ShowTypeLevel,ElementName=propertiesTree}" DataContext="{Binding TypeSelector}" TypeLevel="{Binding TypeLevel,Mode=TwoWay}" />

		<local:TreeViewEx x:Name="propertiesTree" Grid.Row="4" Grid.Column="2" Margin="0,4,0,0" Style="{DynamicResource SelectionTreeView}" SelectedDataItem="{Binding SelectedPropertyElement,Mode=TwoWay}">
			<local:TreeViewItemEx Header="{Binding PropertyRoot.Value.TargetType.Name}" IsExpanded="True" ItemsSource="{Binding PropertyRoot.Value.Children}" ItemContainerStyle="{DynamicResource SelectionTreeViewItem}">
				<local:TreeViewItemEx.ItemTemplate>
					<HierarchicalDataTemplate DataType="vms:PropertyTreeElement" ItemsSource="{Binding Children.Value}">
						<TextBlock>
							<TextBlock.Text>
								<MultiBinding StringFormat="{}{0}: ({1})">
									<Binding Path="Property.Name" Mode="OneTime" />
									<Binding Path="Property.RealType.Name" Mode="OneTime" />
								</MultiBinding>
							</TextBlock.Text>
						</TextBlock>
					</HierarchicalDataTemplate>
				</local:TreeViewItemEx.ItemTemplate>
			</local:TreeViewItemEx>
		</local:TreeViewEx>

		<StackPanel Grid.Column="0" Grid.Row="5">
			<TextBlock Text="Converter" Margin="0,8,0,4" />
			<ComboBox ItemsSource="{Binding ValueConverters.Value}" SelectedItem="{Binding SelectedValueConverter,Mode=TwoWay}" DisplayMemberPath="Name" />
		</StackPanel>

		<Expander Name="moreSettings" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="6" Header="More Settings" Margin="0,8,0,0" Style="{StaticResource MoreSettings}" Expanded="OnMoreSettingsExpanded" Collapsed="OnMoreSettingsCollapsed">
			<Border Margin="0,4,0,0" Background="{DynamicResource GroupBackgroundBrush}" BorderBrush="{DynamicResource GroupBorderBrush}">
				<Grid Margin="8,0,8,8">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*" />
						<ColumnDefinition Width="10" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>

					<ItemsControl Grid.Column="0" ItemsSource="{Binding BindingProperties}" Focusable="False">
						<ItemsControl.ItemTemplate>
							<DataTemplate>
								<StackPanel Margin="0,8,0,0">
									<TextBlock Text="{Binding Property.Name,Mode=OneTime}" Margin="0,0,0,4" />
									<ContentPresenter ContentTemplateSelector="{DynamicResource PropertyEditorSelector}" />
								</StackPanel>
							</DataTemplate>
						</ItemsControl.ItemTemplate>
					</ItemsControl>

					<ItemsControl Grid.Column="2" ItemsSource="{Binding FlagsProperties}">
						<ItemsControl.ItemTemplate>
							<DataTemplate>
								<CheckBox Margin="0,8,0,0" VerticalContentAlignment="Center" Foreground="{DynamicResource DialogForegroundBrush}" Content="{Binding Property.Name,Mode=OneTime}" AutomationProperties.Name="{Binding Property.Name,Mode=OneTime}" IsChecked="{Binding Value}" IsEnabled="{Binding Property.CanWrite,Mode=OneTime}" VerticalAlignment="Center" />
							</DataTemplate>
						</ItemsControl.ItemTemplate>
					</ItemsControl>
				</Grid>
			</Border>
		</Expander>

		<StackPanel Grid.Row="7" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
			<Button MinHeight="23" MinWidth="75" IsEnabled="{Binding CanCreateBinding}" Content="{x:Static prop:Resources.OK}" IsDefault="True" Click="OnOkClicked" />
			<Button MinHeight="23" MinWidth="75" Margin="4,0,0,0" Content="{x:Static prop:Resources.Cancel}" IsCancel="True" />
		</StackPanel>
	</Grid>
</local:WindowEx>