Repository navigation
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
357 lines (354 loc) · 19.3 KB
/
Copy pathMainWindow.xaml
File metadata and controls
357 lines (354 loc) · 19.3 KB
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<wd:Window
x:Class="WPFDevelopers.Samples.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:example="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:helpers="clr-namespace:WPFDevelopers.Samples.Helpers"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:WPFDevelopers.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:WPFDevelopers.Samples.ViewModels"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="WPFDevelopers"
Width="{x:Static local:App.Wdith}"
Height="{x:Static local:App.Height}"
Icon="pack://application:,,,/WPFDevelopers.Samples;component/WPFDevelopers.ico"
TitleBarMode="High"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<wd:Window.TitleBarLayout>
<StackPanel
HorizontalAlignment="Right"
wd:PanelHelper.Spacing="2"
Orientation="Horizontal">
<Border
Margin="4,0,6,0"
Padding="8,3"
VerticalAlignment="Center"
Background="#33FFFFFF"
CornerRadius="9">
<TextBlock
x:Name="VersionText"
FontSize="11"
FontWeight="SemiBold"
Foreground="White" />
</Border>
<wd:SwitchButton
x:Name="LanguageSwitchBtn"
Width="30"
Height="30"
IsChecked="{Binding DataContext.IsChineseLanguage, RelativeSource={RelativeSource AncestorType=Window}, Mode=TwoWay}"
ToolTip="中文 / English">
<wd:SwitchButton.UncheckedContent>
<TextBlock Foreground="White" Text="中" />
</wd:SwitchButton.UncheckedContent>
<wd:SwitchButton.CheckedContent>
<TextBlock Foreground="White" Text="EN" />
</wd:SwitchButton.CheckedContent>
</wd:SwitchButton>
<wd:SwitchButton
x:Name="ThemeSwitchBtn"
Width="30"
Height="30"
Click="ThemeSwitchBtn_Click">
<wd:SwitchButton.UncheckedContent>
<Border
Width="18"
Height="18"
Background="White"
CornerRadius="10">
<wd:PathIcon
Width="16"
Height="16"
Data="M12 2a10 10 0 1 0 10 10A7 7 0 0 1 12 2Z"
Foreground="{DynamicResource WD.WindowBorderBrush}" />
</Border>
</wd:SwitchButton.UncheckedContent>
<wd:SwitchButton.CheckedContent>
<wd:PathIcon
Width="18"
Height="18"
Data="M12 19a7 7 0 1 1 0-14 7 7 0 0 1 0 14Zm0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11Zm-5.657.157a.75.75 0 0 1 0 1.06l-1.768 1.768a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.767-1.768a.75.75 0 0 1 1.061 0ZM3.515 3.515a.75.75 0 0 1 1.06 0l1.768 1.768a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L3.515 4.575a.75.75 0 0 1 0-1.06ZM12 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 12 0ZM4 12a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 4 12Zm8 8a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5A.75.75 0 0 1 12 20Zm12-8a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 24 12Zm-6.343 5.657a.75.75 0 0 1 1.06 0l1.768 1.768a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-1.768-1.767a.75.75 0 0 1 0-1.061Zm2.828-14.142a.75.75 0 0 1 0 1.06l-1.768 1.768a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l1.767-1.768a.75.75 0 0 1 1.061 0Z"
Foreground="White" />
</wd:SwitchButton.CheckedContent>
</wd:SwitchButton>
<wd:SwitchButton
x:Name="ColorSwitchBtn"
Width="30"
Height="30">
<wd:SwitchButton.UncheckedContent>
<wd:PathIcon
Width="18"
Height="18"
Data="M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"
Foreground="White" />
</wd:SwitchButton.UncheckedContent>
<wd:SwitchButton.CheckedContent>
<wd:PathIcon
Width="18"
Height="18"
Data="M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"
Foreground="White" />
</wd:SwitchButton.CheckedContent>
</wd:SwitchButton>
<Popup
AllowsTransparency="True"
HorizontalOffset="-200"
IsOpen="{Binding IsChecked, ElementName=ColorSwitchBtn, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=ColorSwitchBtn}"
StaysOpen="False">
<Border
Margin="10"
Background="{DynamicResource WD.BackgroundBrush}"
BorderBrush="{DynamicResource WD.BaseBrush}"
BorderThickness="1"
CornerRadius="4"
Effect="{StaticResource WD.PopupShadowDepth}">
<StackPanel Margin="2">
<wd:ColorPicker x:Name="ThemeColorPicker" />
<StackPanel
Margin="2"
HorizontalAlignment="Right"
wd:PanelHelper.Spacing="4"
Orientation="Horizontal">
<Button
Click="ColorPicker_Apply"
Content="Apply"
Style="{StaticResource WD.PrimaryButton}" />
<Button
Click="ColorPicker_Cancel"
Content="Cancel"
Style="{StaticResource WD.DefaultButton}" />
</StackPanel>
</StackPanel>
</Border>
</Popup>
</StackPanel>
</wd:Window.TitleBarLayout>
<wd:Window.Effect>
<wd:GrayscaleEffect x:Name="grayscaleEffect" Factor="1" />
</wd:Window.Effect>
<Window.DataContext>
<vm:MainVM />
</Window.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding ViewLoaded}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid>
<wd:NotifyIcon Name="WpfNotifyIcon" Title="WPF开发者">
<wd:NotifyIcon.ContextMenu>
<ContextMenu>
<MenuItem
Name="menuItemGrayscale"
Click="Grayscale_Click"
Header="开启灰度" />
<MenuItem Click="SendMessage_Click" Header="托盘消息" />
<MenuItem
Name="menuItemTwink"
Click="Twink_Click"
Header="闪烁" />
<MenuItem Click="About_Click" Header="关于">
<MenuItem.Icon>
<Path
Width="20"
Height="20"
Data="{StaticResource WD.WarningGeometry}"
Fill="{DynamicResource WD.PrimaryBrush}"
Stretch="Uniform" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Click="Quit_Click" Header="退出" />
</ContextMenu>
</wd:NotifyIcon.ContextMenu>
</wd:NotifyIcon>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="150" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<DockPanel>
<Button
Width="34"
Height="34"
Margin="0,0,6,0"
AutomationProperties.Name="首页 / Home"
Command="{Binding ShowHomeCommand}"
Style="{StaticResource WD.DefaultButton}"
ToolTip="首页 / Home">
<wd:PathIcon
Width="18"
Height="18"
Foreground="{DynamicResource WD.PrimaryBrush}"
Kind="Home" />
</Button>
<TextBox
Name="PART_MenuTextBox"
wd:ElementHelper.IsClear="True"
wd:ElementHelper.Watermark="{Binding SearchWatermark}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged">
<i:InvokeCommandAction Command="{Binding MenuSearchTextChanged}" CommandParameter="{Binding ElementName=PART_MenuTextBox, Path=Text}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
</DockPanel>
<wd:Segmented
Grid.Row="1"
Margin="0,3"
wd:ElementHelper.CornerRadius="15"
SelectedIndex="{Binding SegmentedSelectedIndex, Mode=TwoWay}">
<wd:SegmentedItem Content="{Binding CustomMenuLabel}" />
<wd:SegmentedItem Content="{Binding BasicMenuLabel}" />
</wd:Segmented>
<controls:NavigateMenu
x:Name="NavigateMenu"
Grid.Row="2"
ItemsSource="{Binding NavigateMenuModelList}"
SelectedItem="{Binding NavigateMenuItem, Mode=TwoWay}">
<controls:NavigateMenu.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<wd:SvgViewer
Width="16"
Height="16"
Margin="0,0,8,0"
VerticalAlignment="Center"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
Source="{Binding IconSource}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding DisplayName}" />
<Border
x:Name="DemoBadge"
Grid.Column="2"
Margin="8,0,0,0"
Padding="5,2"
Background="#FF526D82"
CornerRadius="3"
ToolTip="{Binding DataContext.DemoBadgeToolTip, RelativeSource={RelativeSource AncestorType=controls:NavigateMenu}}"
Visibility="Collapsed">
<TextBlock
FontSize="10"
FontWeight="SemiBold"
Foreground="White"
Text="DEMO" />
</Border>
<Border
x:Name="ChangeBadge"
Grid.Column="3"
Margin="8,0,0,0"
Padding="5,2"
Background="#FFE5484D"
CornerRadius="3"
Visibility="Collapsed">
<TextBlock
x:Name="ChangeBadgeText"
FontSize="10"
FontWeight="SemiBold"
Foreground="White"
Text="" />
</Border>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsDemo}" Value="True">
<Setter TargetName="DemoBadge" Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding ChangeType}" Value="New">
<Setter TargetName="ChangeBadge" Property="Visibility" Value="Visible" />
<Setter TargetName="ChangeBadgeText" Property="Text" Value="NEW" />
</DataTrigger>
<DataTrigger Binding="{Binding ChangeType}" Value="Updated">
<Setter TargetName="ChangeBadge" Property="Visibility" Value="Visible" />
<Setter TargetName="ChangeBadge" Property="Background" Value="#FFFFC857" />
<Setter TargetName="ChangeBadgeText" Property="Foreground" Value="#FF493500" />
<Setter TargetName="ChangeBadgeText" Property="Text" Value="UPDATE" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:NavigateMenu.ItemTemplate>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding MenuSelectionChangedCommand}" CommandParameter="{Binding ElementName=NavigateMenu, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</controls:NavigateMenu>
</Grid>
<GridSplitter
Grid.Column="1"
Width="5"
Margin="2,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ShowsPreview="True" />
<wd:Drawer
x:Name="CodeDrawer"
Grid.Column="2"
BorderThickness="0"
Position="Right">
<wd:Drawer.Header>
<controls:CodeViewer Header="MainWindow">
<controls:CodeViewer.SourceCodes>
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/MainWindow.xaml" CodeType="Xaml" />
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/MainWindow.xaml.cs" CodeType="CSharp" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/ViewModels/MainVM.cs"
CodeType="CSharp"
Haader="ViewModel" />
</controls:CodeViewer.SourceCodes>
</controls:CodeViewer>
</wd:Drawer.Header>
<ContentControl Content="{Binding ControlPanel}" />
</wd:Drawer>
<wd:CircleMenu
Grid.Column="2"
Width="100"
Height="100"
Margin="20"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
ItemClickCommand="{Binding CircleMenuItemClickCommand, RelativeSource={RelativeSource AncestorType=Window}}">
<wd:CircleMenuItem x:Name="ScreenShot" ToolTip="ScreenShot">
<wd:SvgViewer Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Svg/ScreenShot.svg" />
</wd:CircleMenuItem>
<wd:CircleMenuItem x:Name="Github" ToolTip="Github">
<wd:SvgViewer Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Svg/Github.svg" />
</wd:CircleMenuItem>
<wd:CircleMenuItem x:Name="Grayscale" ToolTip="Grayscale">
<wd:SvgViewer x:Name="GrayscaleSvg" Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Svg/EnableGrayscale.svg" />
</wd:CircleMenuItem>
<wd:CircleMenuItem x:Name="Theme" ToolTip="Theme">
<wd:SvgViewer x:Name="ThemeSvg" Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Svg/Sun.svg" />
</wd:CircleMenuItem>
<wd:CircleMenuItem x:Name="Code" ToolTip="MainWindow Code">
<wd:SvgViewer Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Svg/Code.svg" />
</wd:CircleMenuItem>
<wd:CircleMenuItem x:Name="ClearToast" ToolTip="Clear Toast">
<wd:PathIcon
Width="10"
Height="10"
Kind="WindowClose" />
</wd:CircleMenuItem>
</wd:CircleMenu>
</Grid>
</Grid>
</wd:Window>