-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
HamburgerMenu.HamburgerButton.cs
161 lines (142 loc) · 7.6 KB
/
HamburgerMenu.HamburgerButton.cs
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
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
namespace MahApps.Metro.Controls
{
[StyleTypedProperty(Property = nameof(HamburgerButtonStyle), StyleTargetType = typeof(Button))]
public partial class HamburgerMenu
{
/// <summary>Identifies the <see cref="HamburgerWidth"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerWidthProperty
= DependencyProperty.Register(nameof(HamburgerWidth),
typeof(double),
typeof(HamburgerMenu),
new PropertyMetadata(48.0));
/// <summary>
/// Gets or sets HamburgerMenu button's <see cref="FrameworkElement.Width"/>.
/// </summary>
public double HamburgerWidth
{
get => (double)this.GetValue(HamburgerWidthProperty);
set => this.SetValue(HamburgerWidthProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerHeight"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerHeightProperty
= DependencyProperty.Register(nameof(HamburgerHeight),
typeof(double),
typeof(HamburgerMenu),
new PropertyMetadata(48.0));
/// <summary>
/// Gets or sets the <see cref="FrameworkElement.Height"/> for the HamburgerMenu button.
/// </summary>
public double HamburgerHeight
{
get => (double)this.GetValue(HamburgerHeightProperty);
set => this.SetValue(HamburgerHeightProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerMargin"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerMarginProperty
= DependencyProperty.Register(nameof(HamburgerMargin),
typeof(Thickness),
typeof(HamburgerMenu),
new PropertyMetadata(new Thickness()));
/// <summary>
/// Gets or sets the margin for the HamburgerMenu button.
/// </summary>
public Thickness HamburgerMargin
{
get => (Thickness)this.GetValue(HamburgerMarginProperty);
set => this.SetValue(HamburgerMarginProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerVisibility"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerVisibilityProperty
= DependencyProperty.Register(nameof(HamburgerVisibility),
typeof(Visibility),
typeof(HamburgerMenu),
new PropertyMetadata(Visibility.Visible));
/// <summary>
/// Gets or sets the <see cref="UIElement.Visibility"/> for the HamburgerMenu button.
/// </summary>
public Visibility HamburgerVisibility
{
get => (Visibility)this.GetValue(HamburgerVisibilityProperty);
set => this.SetValue(HamburgerVisibilityProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerButtonStyle"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerButtonStyleProperty
= DependencyProperty.Register(nameof(HamburgerButtonStyle),
typeof(Style),
typeof(HamburgerMenu),
new PropertyMetadata(null));
/// <summary>
/// Gets or sets the <see cref="FrameworkElement.Style"/> for the HamburgerMenu button.
/// </summary>
public Style HamburgerButtonStyle
{
get => (Style)this.GetValue(HamburgerButtonStyleProperty);
set => this.SetValue(HamburgerButtonStyleProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerButtonTemplate"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerButtonTemplateProperty
= DependencyProperty.Register(nameof(HamburgerButtonTemplate),
typeof(DataTemplate),
typeof(HamburgerMenu),
new PropertyMetadata(null));
/// <summary>
/// Gets or sets the <see cref="ContentControl.ContentTemplate"/> for the HamburgerMenu button.
/// </summary>
public DataTemplate HamburgerButtonTemplate
{
get => (DataTemplate)this.GetValue(HamburgerButtonTemplateProperty);
set => this.SetValue(HamburgerButtonTemplateProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerButtonName"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerButtonNameProperty
= DependencyProperty.Register(nameof(HamburgerButtonName),
typeof(string),
typeof(HamburgerMenu),
new UIPropertyMetadata(string.Empty),
new ValidateValueCallback(IsNotNull));
/// <summary>
/// Gets or sets the<see cref= "AutomationProperties.NameProperty" /> for the HamburgerMenu button.
/// </summary>
public string HamburgerButtonName
{
get => (string)this.GetValue(HamburgerButtonNameProperty);
set => this.SetValue(HamburgerButtonNameProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerButtonHelpText"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerButtonHelpTextProperty
= DependencyProperty.Register(nameof(HamburgerButtonHelpText),
typeof(string),
typeof(HamburgerMenu),
new UIPropertyMetadata(string.Empty),
new ValidateValueCallback(IsNotNull));
/// <summary>
/// Gets or sets the <see cref="AutomationProperties.HelpTextProperty"/> for the HamburgerMenu button.
/// </summary>
public string HamburgerButtonHelpText
{
get => (string)this.GetValue(HamburgerButtonHelpTextProperty);
set => this.SetValue(HamburgerButtonHelpTextProperty, value);
}
/// <summary>Identifies the <see cref="HamburgerMenuHeaderTemplate"/> dependency property.</summary>
public static readonly DependencyProperty HamburgerMenuHeaderTemplateProperty
= DependencyProperty.Register(nameof(HamburgerMenuHeaderTemplate),
typeof(DataTemplate),
typeof(HamburgerMenu),
new PropertyMetadata(null));
/// <summary>
/// Gets or sets the <see cref="ContentControl.ContentTemplate"/> for the HamburgerMenu pane header.
/// </summary>
public DataTemplate HamburgerMenuHeaderTemplate
{
get => (DataTemplate)this.GetValue(HamburgerMenuHeaderTemplateProperty);
set => this.SetValue(HamburgerMenuHeaderTemplateProperty, value);
}
private static bool IsNotNull(object value)
{
return value != null;
}
}
}