forked from Kinnara/ModernWpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplitView.properties.cs
258 lines (202 loc) · 8.18 KB
/
SplitView.properties.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
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
using System.Windows;
using System.Windows.Media;
using ModernWpf.Controls.Primitives;
namespace ModernWpf.Controls
{
partial class SplitView
{
#region CompactPaneLength
public static readonly DependencyProperty CompactPaneLengthProperty =
DependencyProperty.Register(
nameof(CompactPaneLength),
typeof(double),
typeof(SplitView),
new PropertyMetadata(OnCompactPaneLengthPropertyChanged));
public double CompactPaneLength
{
get => (double)GetValue(CompactPaneLengthProperty);
set => SetValue(CompactPaneLengthProperty, value);
}
private static void OnCompactPaneLengthPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnCompactPaneLengthPropertyChanged(args);
}
private void OnCompactPaneLengthPropertyChanged(DependencyPropertyChangedEventArgs args)
{
UpdateTemplateSettings();
CompactPaneLengthChanged?.Invoke(this, args.Property);
}
#endregion
#region Content
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register(
nameof(Content),
typeof(UIElement),
typeof(SplitView));
public UIElement Content
{
get => (UIElement)GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
#endregion
#region DisplayMode
public static readonly DependencyProperty DisplayModeProperty =
DependencyProperty.Register(
nameof(DisplayMode),
typeof(SplitViewDisplayMode),
typeof(SplitView),
new PropertyMetadata(SplitViewDisplayMode.Overlay, OnDisplayModePropertyChanged));
public SplitViewDisplayMode DisplayMode
{
get => (SplitViewDisplayMode)GetValue(DisplayModeProperty);
set => SetValue(DisplayModeProperty, value);
}
private static void OnDisplayModePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnDisplayModePropertyChanged(args);
}
private void OnDisplayModePropertyChanged(DependencyPropertyChangedEventArgs args)
{
UpdateIsLightDismissActive();
UpdateVisualState();
DisplayModeChanged?.Invoke(this, args.Property);
}
#endregion
#region IsPaneOpen
public static readonly DependencyProperty IsPaneOpenProperty =
DependencyProperty.Register(
nameof(IsPaneOpen),
typeof(bool),
typeof(SplitView),
new PropertyMetadata(OnIsPaneOpenPropertyChanged));
public bool IsPaneOpen
{
get => (bool)GetValue(IsPaneOpenProperty);
set => SetValue(IsPaneOpenProperty, value);
}
private static void OnIsPaneOpenPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnIsPaneOpenPropertyChanged(args);
}
private void OnIsPaneOpenPropertyChanged(DependencyPropertyChangedEventArgs args)
{
if ((bool)args.NewValue)
{
_isPaneClosing = false;
OpenPane();
}
else
{
_isPaneOpening = false;
ClosePane();
}
UpdateIsLightDismissActive();
UpdateOverlayVisibilityState();
IsPaneOpenChanged?.Invoke(this, args.Property);
}
#endregion
#region OpenPaneLength
public static readonly DependencyProperty OpenPaneLengthProperty =
DependencyProperty.Register(
nameof(OpenPaneLength),
typeof(double),
typeof(SplitView),
new PropertyMetadata(OnOpenPaneLengthPropertyChanged));
public double OpenPaneLength
{
get => (double)GetValue(OpenPaneLengthProperty);
set => SetValue(OpenPaneLengthProperty, value);
}
private static void OnOpenPaneLengthPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnOpenPaneLengthPropertyChanged(args);
}
private void OnOpenPaneLengthPropertyChanged(DependencyPropertyChangedEventArgs args)
{
UpdateTemplateSettings();
UpdatePaneClipRectangle();
}
#endregion
#region PaneBackground
public static readonly DependencyProperty PaneBackgroundProperty =
DependencyProperty.Register(
nameof(PaneBackground),
typeof(Brush),
typeof(SplitView));
public Brush PaneBackground
{
get => (Brush)GetValue(PaneBackgroundProperty);
set => SetValue(PaneBackgroundProperty, value);
}
#endregion
#region PanePlacement
public static readonly DependencyProperty PanePlacementProperty =
DependencyProperty.Register(
nameof(PanePlacement),
typeof(SplitViewPanePlacement),
typeof(SplitView),
new PropertyMetadata(SplitViewPanePlacement.Left, OnPanePlacementPropertyChanged));
public SplitViewPanePlacement PanePlacement
{
get => (SplitViewPanePlacement)GetValue(PanePlacementProperty);
set => SetValue(PanePlacementProperty, value);
}
private static void OnPanePlacementPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnPanePlacementPropertyChanged(args);
}
private void OnPanePlacementPropertyChanged(DependencyPropertyChangedEventArgs args)
{
UpdateDisplayModeState();
}
#endregion
#region Pane
public static readonly DependencyProperty PaneProperty =
DependencyProperty.Register(
nameof(Pane),
typeof(UIElement),
typeof(SplitView));
public UIElement Pane
{
get => (UIElement)GetValue(PaneProperty);
set => SetValue(PaneProperty, value);
}
#endregion
#region TemplateSettings
private static readonly DependencyPropertyKey TemplateSettingsPropertyKey =
DependencyProperty.RegisterReadOnly(
nameof(TemplateSettings),
typeof(SplitViewTemplateSettings),
typeof(SplitView),
null);
public static readonly DependencyProperty TemplateSettingsProperty =
TemplateSettingsPropertyKey.DependencyProperty;
public SplitViewTemplateSettings TemplateSettings
{
get => (SplitViewTemplateSettings)GetValue(TemplateSettingsProperty);
private set => SetValue(TemplateSettingsPropertyKey, value);
}
#endregion
#region LightDismissOverlayMode
public static readonly DependencyProperty LightDismissOverlayModeProperty =
DependencyProperty.Register(
nameof(LightDismissOverlayMode),
typeof(LightDismissOverlayMode),
typeof(SplitView),
new PropertyMetadata(LightDismissOverlayMode.Auto, OnLightDismissOverlayModePropertyChanged));
public LightDismissOverlayMode LightDismissOverlayMode
{
get => (LightDismissOverlayMode)GetValue(LightDismissOverlayModeProperty);
set => SetValue(LightDismissOverlayModeProperty, value);
}
private static void OnLightDismissOverlayModePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
((SplitView)sender).OnLightDismissOverlayModePropertyChanged(args);
}
private void OnLightDismissOverlayModePropertyChanged(DependencyPropertyChangedEventArgs args)
{
UpdateOverlayVisibilityState();
}
#endregion
}
}