-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathMainWindow.xaml
274 lines (261 loc) · 13.3 KB
/
MainWindow.xaml
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<Window
x:Class="WPFGallery.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFGallery.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="clr-namespace:WPFGallery.Helpers"
xmlns:local="clr-namespace:WPFGallery"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{Binding ViewModel.ApplicationTitle}"
d:DataContext="{d:DesignInstance local:MainWindow, IsDesignTimeCreatable=False}"
d:DesignHeight="650"
d:DesignWidth="1000"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d"
MinWidth="780"
MinHeight="450">
<Window.Resources>
<helpers:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
<Style x:Key="TitleBarDefaultButtonStyle" TargetType="Button">
<Setter Property="MinWidth" Value="48" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="EnclosingBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ControlAltFillColorQuarternaryBrush}" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=(SystemParameters.HighContrast)}" Value="True" />
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource SystemColorHighlightColorBrush}" />
<Setter Property="Foreground" Value="{DynamicResource SystemColorHighlightTextColorBrush}" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="TitleBarDefaultCloseButtonStyle" BasedOn="{StaticResource TitleBarDefaultButtonStyle}" TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#C42B1C" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=(SystemParameters.HighContrast)}" Value="True" />
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource SystemColorHighlightColorBrush}" />
<Setter Property="Foreground" Value="{DynamicResource SystemColorHighlightTextColorBrush}" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Border x:Name="HighContrastBorder" BorderBrush="Transparent" BorderThickness="8 1 8 8">
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="44" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid
Grid.Row="0"
Grid.ColumnSpan="2"
Height="44">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
x:Name="BackButton"
Grid.Column="0"
Height="32"
Width="40"
Margin="4,0"
VerticalAlignment="Center"
AutomationProperties.Name="Back"
Background="Transparent"
BorderBrush="Transparent"
Command="{Binding ViewModel.BackCommand}"
IsEnabled="{Binding ViewModel.CanNavigateback}"
WindowChrome.IsHitTestVisibleInChrome="True"
ToolTipService.ToolTip="Back">
<Button.Resources>
<SolidColorBrush x:Key="ButtonBackgroundDisabled" Color="Transparent" />
<SolidColorBrush x:Key="ButtonBorderBrushDisabled" Color="Transparent" />
</Button.Resources>
<TextBlock
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="12"
Text="">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}">
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Button>
<StackPanel
Grid.Column="1"
Margin="4,0,0,0"
Orientation="Horizontal">
<Image
Width="20"
VerticalAlignment="Center"
Source="pack://application:,,,/Assets/WPFGalleryPreviewIcon.png" />
<TextBlock
Margin="16,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
AutomationProperties.HeadingLevel="Level1"
Text="WPF Gallery Preview" />
</StackPanel>
<Button
x:Name="MinimizeButton"
Grid.Column="2"
Click="MinimizeWindow"
Style="{StaticResource TitleBarDefaultButtonStyle}">
<TextBlock
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="10"
Text="" />
</Button>
<Button
x:Name="MaximizeButton"
Grid.Column="3"
Click="MaximizeWindow"
Style="{StaticResource TitleBarDefaultButtonStyle}">
<TextBlock
x:Name="MaximizeIcon"
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="10"
Text="" />
</Button>
<Button
x:Name="CloseButton"
Grid.Column="4"
Click="CloseWindow"
Style="{StaticResource TitleBarDefaultCloseButtonStyle}">
<TextBlock
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="16"
Text="" />
</Button>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--<TextBox
x:Name="SearchBox"
Width="250"
Margin="10"
AutomationProperties.Name="Search"
KeyUp="SearchBox_KeyUp"
LostFocus="SearchBox_LostFocus" />-->
<TreeView
x:Name="ControlsList"
Grid.Row="1"
Margin="8,8,0,0"
AutomationProperties.Name="Navigation Pane"
ItemsSource="{Binding ViewModel.Controls}"
PreviewKeyDown="ControlsList_PreviewKeyDown"
PreviewMouseLeftButtonUp="ControlsList_PreviewMouseLeftButtonUp"
Loaded="ControlsList_Loaded">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Items}">
<Grid MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
MaxWidth="16"
VerticalAlignment="Center"
AutomationProperties.Name="{Binding Title, StringFormat='{}{0} Page'}"
Focusable="False"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="16"
Text="{Binding IconGlyph}"
Visibility="{Binding IconGlyph, Converter={StaticResource EmptyToVisibilityConverter}}" />
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
Text="{Binding Title}" />
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<DockPanel Grid.Row="2">
<Button
x:Name="SettingsButton"
Width="250"
Margin="10"
HorizontalContentAlignment="Left"
AutomationProperties.Name="Settings"
Command="{Binding ViewModel.SettingsCommand}"
Click="SettingsButton_Click"
DockPanel.Dock="Bottom">
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="SettingsIcon" Margin="0,4,0,0" FontFamily="{StaticResource SymbolThemeFontFamily}"></TextBlock>
<TextBlock Margin="8,0,0,0" Text="Settings" />
</StackPanel>
</Button>
</DockPanel>
</Grid>
<Border
Grid.Column="1"
Margin="4,0,0,0"
Padding="24,16,24,0"
Background="{DynamicResource LayerFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8,0,0,0">
<Frame x:Name="RootContentFrame" Navigated="RootContentFrame_Navigated"/>
</Border>
</Grid>
</Grid>
</Border>
</Window>