-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathDrawerMenuExample.xaml
More file actions
119 lines (119 loc) · 6.82 KB
/
DrawerMenuExample.xaml
File metadata and controls
119 lines (119 loc) · 6.82 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
<UserControl
x:Class="WPFDevelopers.Samples.ExampleViews.DrawerMenu.DrawerMenuExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews.DrawerMenu"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<controls:CodeViewer Header="{Binding NavigateMenuItem.Name}">
<TabControl>
<TabItem Header="DrawerMenu - Xaml">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Frame
Name="myFrame"
Grid.Column="1"
NavigationUIVisibility="Hidden" />
<wd:DrawerMenu SelectedItemChanged="DrawerMenu_SelectedItemChanged">
<wd:DrawerMenuItem Text="主页">
<wd:DrawerMenuItem.Icon>
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/2.png" />
</wd:DrawerMenuItem.Icon>
</wd:DrawerMenuItem>
<wd:DrawerMenuItem Text="Edge">
<wd:DrawerMenuItem.Icon>
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/4.png" />
</wd:DrawerMenuItem.Icon>
</wd:DrawerMenuItem>
<wd:DrawerMenuItem Text="云盘">
<wd:DrawerMenuItem.Icon>
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/1.png" />
</wd:DrawerMenuItem.Icon>
</wd:DrawerMenuItem>
<wd:DrawerMenuItem Text="邮件">
<wd:DrawerMenuItem.Icon>
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/8.png" />
</wd:DrawerMenuItem.Icon>
</wd:DrawerMenuItem>
<wd:DrawerMenuItem Text="视频">
<wd:DrawerMenuItem.Icon>
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/6.png" />
</wd:DrawerMenuItem.Icon>
</wd:DrawerMenuItem>
<wd:DrawerMenuItem Text="Bus">
<wd:DrawerMenuItem.Icon>
<Path
Width="20"
Height="20"
Data="{StaticResource WD.BusGeometry}"
Fill="{DynamicResource WD.PlaceholderTextBrush}"
Stretch="Uniform" />
</wd:DrawerMenuItem.Icon>
<wd:DrawerMenuItem Text="Bus 1" />
<wd:DrawerMenuItem Text="Bus 2" />
</wd:DrawerMenuItem>
</wd:DrawerMenu>
</Grid>
</TabItem>
<TabItem Header="DrawerMenu binding">
<wd:DrawerMenu
IsOpenCommand="{Binding IsOpenCommand, RelativeSource={RelativeSource AncestorType=local:DrawerMenuExample}}"
ItemsSource="{Binding DrawerMenuItems, RelativeSource={RelativeSource AncestorType=local:DrawerMenuExample}}"
SelectionCommand="{Binding SelectionCommand, RelativeSource={RelativeSource AncestorType=local:DrawerMenuExample}}">
<wd:DrawerMenu.OpenIcon>
<Image
Width="30"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Assets/Clear.png"
Stretch="Uniform" />
</wd:DrawerMenu.OpenIcon>
<wd:DrawerMenu.ClosedIcon>
<Path
Width="20"
Data="{StaticResource WD.MenuGeometry}"
Fill="{DynamicResource WD.PrimaryBrush}"
Stretch="Uniform" />
</wd:DrawerMenu.ClosedIcon>
</wd:DrawerMenu>
</TabItem>
<TabItem Header="Binding">
<wd:DrawerMenu ItemsSource="{Binding MenuItems, RelativeSource={RelativeSource AncestorType=local:DrawerMenuExample}}">
<wd:DrawerMenu.ItemContainerStyle>
<Style BasedOn="{StaticResource WD.DrawerMenuItem}" TargetType="{x:Type wd:DrawerMenuItem}">
<Setter Property="Text" Value="{Binding Text}" />
<Setter Property="Icon" Value="{Binding Icon}" />
<Setter Property="ItemsSource" Value="{Binding Children}" />
</Style>
</wd:DrawerMenu.ItemContainerStyle>
<wd:DrawerMenu.OpenIcon>
<Path
Width="15"
Data="{StaticResource WD.MenuGeometry}"
Fill="{DynamicResource WD.PrimaryBrush}"
Stretch="Uniform" />
</wd:DrawerMenu.OpenIcon>
<wd:DrawerMenu.ClosedIcon>
<Path
Width="15"
Data="{StaticResource WD.MenuGeometry}"
Fill="{DynamicResource WD.PrimaryBrush}"
Stretch="Uniform" />
</wd:DrawerMenu.ClosedIcon>
</wd:DrawerMenu>
</TabItem>
</TabControl>
<controls:CodeViewer.SourceCodes>
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/DrawerMenu/DrawerMenuExample.xaml" CodeType="Xaml" />
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/DrawerMenu/DrawerMenuExample.xaml.cs" CodeType="CSharp" />
</controls:CodeViewer.SourceCodes>
</controls:CodeViewer>
</UserControl>