-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathMaterialDesignTheme.PopupBox.xaml
More file actions
533 lines (520 loc) · 32.1 KB
/
MaterialDesignTheme.PopupBox.xaml
File metadata and controls
533 lines (520 loc) · 32.1 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Separator.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolTip.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="MaterialDesignPopupBoxButton" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Padding" Value="16,0,16,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid ClipToBounds="True">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.3" To="Normal">
<VisualTransition.GeneratedEasingFunction>
<CircleEase EasingMode="EaseOut" />
</VisualTransition.GeneratedEasingFunction>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState Name="Normal" />
<VisualState Name="MouseOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="MouseOverBorder"
Storyboard.TargetProperty="Opacity"
To="0.1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState Name="Disabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.48"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="MouseOverBorder"
Background="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}"
Opacity="0" />
<wpf:Ripple MinHeight="48"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Feedback="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}"
Focusable="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<wpf:PackIcon x:Key="MaterialDesignPopupBoxToggleContent"
Width="24"
Height="24"
Margin="4,0,4,0"
x:Shared="False"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Foreground}"
Kind="DotsVertical" />
<Style x:Key="MaterialDesignPopupBox" TargetType="{x:Type wpf:PopupBox}">
<Setter Property="Focusable" Value="True" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Padding" Value="0,8,0,8" />
<Setter Property="PopupElevation" Value="Dp6" />
<Setter Property="PopupHorizontalOffset" Value="0" />
<Setter Property="PopupUniformCornerRadius" Value="2" />
<Setter Property="PopupVerticalOffset" Value="0" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type wpf:PopupBox}">
<ControlTemplate.Resources>
<converters:ElevationMarginConverter x:Key="ElevationMarginConverter" />
<converters:ElevationRadiusConverter x:Key="ElevationRadiusConverter" Multiplier="-1" />
<converters:ElevationRadiusConverter x:Key="RtlElevationRadiusConverter" Multiplier="1" />
<Style TargetType="Separator" BasedOn="{StaticResource MaterialDesignSeparator}" />
<Style x:Key="ToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Border x:Name="border"
Background="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Background}"
BorderBrush="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=BorderBrush}"
BorderThickness="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=BorderThickness}"
CornerRadius="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=(wpf:ButtonAssist.CornerRadius)}" />
<wpf:Ripple Padding="{TemplateBinding Padding}"
ClipToBounds="True"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Focusable="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<wpf:Ripple.Clip>
<MultiBinding Converter="{x:Static converters:BorderClipConverter.Instance}">
<Binding ElementName="border" Path="ActualWidth" />
<Binding ElementName="border" Path="ActualHeight" />
<Binding ElementName="border" Path="CornerRadius" />
<Binding ElementName="border" Path="BorderThickness" />
</MultiBinding>
</wpf:Ripple.Clip>
</wpf:Ripple>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={x:Static converters:BrushOpacityConverter.Instance}, ConverterParameter=0.16}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.38" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ControlTemplate.Resources>
<Grid>
<ToggleButton x:Name="PART_Toggle"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding ToggleContent}"
ContentTemplate="{TemplateBinding ToggleContentTemplate}"
ContentTemplateSelector="{TemplateBinding ToggleContentTemplateSelector}"
Cursor="Hand"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPopupOpen, Mode=TwoWay}"
IsTabStop="{TemplateBinding IsTabStop}"
Padding="0"
Style="{StaticResource ToggleButtonStyle}"
TabIndex="{TemplateBinding TabIndex}" />
<wpf:PopupEx x:Name="PART_Popup"
AllowsTransparency="True"
CustomPopupPlacementCallback="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PopupPlacementMethod}"
HorizontalOffset="{TemplateBinding PopupElevation, Converter={StaticResource ElevationRadiusConverter}}"
IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPopupOpen, Mode=TwoWay}"
Placement="Custom"
PopupAnimation="{TemplateBinding PopupAnimation}"
VerticalOffset="{TemplateBinding PopupElevation, Converter={StaticResource ElevationRadiusConverter}}">
<wpf:PopupEx.PlacementTarget>
<MultiBinding Converter="{x:Static converters:FirstNonNullConverter.Instance}">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="PlacementTarget" />
<Binding ElementName="PART_Toggle" />
</MultiBinding>
</wpf:PopupEx.PlacementTarget>
<wpf:Card Margin="{TemplateBinding PopupElevation, Converter={StaticResource ElevationMarginConverter}}"
Padding="{TemplateBinding Padding}"
wpf:ElevationAssist.Elevation="{TemplateBinding PopupElevation}"
Content="{TemplateBinding PopupContent}"
ContentTemplate="{TemplateBinding PopupContentTemplate}"
Foreground="{DynamicResource MaterialDesign.Brush.Foreground}"
RenderOptions.ClearTypeHint="Enabled"
UniformCornerRadius="{TemplateBinding PopupUniformCornerRadius}">
<wpf:Card.Resources>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignPopupBoxButton}" />
</wpf:Card.Resources>
</wpf:Card>
</wpf:PopupEx>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.38" />
</Trigger>
<Trigger Property="FlowDirection" Value="RightToLeft">
<Setter TargetName="PART_Popup" Property="HorizontalOffset" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ElevationAssist.Elevation), Converter={StaticResource RtlElevationRadiusConverter}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="TextElement.FontWeight" Value="Normal" />
<Setter Property="ToggleContent" Value="{StaticResource MaterialDesignPopupBoxToggleContent}" />
<Setter Property="ToolTipService.IsEnabled" Value="{Binding IsPopupOpen, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NotConverter.Instance}}" />
<Setter Property="wpf:RippleAssist.ClipToBounds" Value="False" />
<Setter Property="wpf:RippleAssist.Feedback" Value="{DynamicResource MaterialDesign.Brush.Button.Ripple}" />
<Setter Property="wpf:RippleAssist.IsCentered" Value="True" />
</Style>
<Style x:Key="MaterialDesignToolPopupBox"
TargetType="wpf:PopupBox"
BasedOn="{StaticResource MaterialDesignPopupBox}">
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Item.Foreground}" />
<Setter Property="Padding" Value="4" />
</Style>
<Style x:Key="MaterialDesignToolForegroundPopupBox"
TargetType="wpf:PopupBox"
BasedOn="{StaticResource MaterialDesignToolPopupBox}">
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground), FallbackValue=Black}" />
</Style>
<wpf:PackIcon x:Key="MaterialDesignMultiFloatingActionPopupBoxIcon"
Width="24"
Height="24"
x:Shared="False"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Foreground}"
Kind="Plus" />
<Style x:Key="MaterialDesignMultiFloatingActionPopupBox" TargetType="{x:Type wpf:PopupBox}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Foreground}" />
<Setter Property="Height" Value="56" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="PlacementMode" Value="TopAndAlignCentres" />
<Setter Property="PopupMode" Value="Click" />
<Setter Property="PopupAnimation" Value="None" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type wpf:PopupBox}">
<ControlTemplate.Resources>
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}">
<Style.Setters>
<Setter Property="Margin" Value="8,10,8,10" />
</Style.Setters>
</Style>
<Style x:Key="ToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid x:Name="RootGrid" Background="{x:Null}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CheckedStates">
<VisualStateGroup.Transitions>
<VisualTransition From="*" To="Checked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ContentRotateTransform"
Storyboard.TargetProperty="Angle"
To="45"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualTransition>
<VisualTransition From="Checked" To="Unchecked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ContentRotateTransform"
Storyboard.TargetProperty="Angle"
To="0"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Checked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ContentRotateTransform"
Storyboard.TargetProperty="Angle"
To="45"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ContentRotateTransform"
Storyboard.TargetProperty="Angle"
To="0"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
<Ellipse x:Name="border"
Effect="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=(wpf:ElevationAssist.Elevation), Converter={x:Static converters:ShadowConverter.Instance}}"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
</AdornerDecorator>
<wpf:Ripple Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Clip="{Binding ElementName=GeometryEllipse, Path=RenderedGeometry}"
ClipToBounds="True"
Focusable="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<!-- additional layer so we don't rotate the ripple directly which can cause jumpyness under certain layouts -->
<ContentControl Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RenderTransformOrigin=".5,.5">
<ContentControl.RenderTransform>
<RotateTransform x:Name="ContentRotateTransform" Angle="0" />
</ContentControl.RenderTransform>
</ContentControl>
<Ellipse x:Name="GeometryEllipse"
Fill="Transparent"
Focusable="False"
IsHitTestVisible="False" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.38" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="wpf:ShadowAssist.Darken" Value="True" />
</Trigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=PopupMode}" Value="{x:Static wpf:PopupBoxPopupMode.MouseOver}">
<Setter TargetName="RootGrid" Property="Background" Value="Transparent" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=PopupMode}" Value="{x:Static wpf:PopupBoxPopupMode.MouseOverEager}">
<Setter TargetName="RootGrid" Property="Background" Value="Transparent" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Storyboard x:Key="Open">
<DoubleAnimation Storyboard.TargetName="PART_PopupContentControl"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="ExplicitToggleContent"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="ExplicitToggleCheckedContent"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="Close">
<DoubleAnimation Storyboard.TargetName="PART_PopupContentControl"
Storyboard.TargetProperty="Opacity"
Duration="0:0:0.8">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="ExplicitToggleContent"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="ExplicitToggleCheckedContent"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.1">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</ControlTemplate.Resources>
<Grid>
<ToggleButton x:Name="PART_Toggle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Cursor="Hand"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPopupOpen, Mode=TwoWay}"
IsTabStop="{TemplateBinding IsTabStop}"
Style="{StaticResource ToggleButtonStyle}"
ToolTip="{TemplateBinding ToolTip}"
ToolTipService.Placement="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=(ToolTipService.Placement)}">
<Grid>
<ContentControl x:Name="StandardToggleContent"
Content="{TemplateBinding ToggleContent}"
ContentTemplate="{TemplateBinding ToggleContentTemplate}"
ContentTemplateSelector="{TemplateBinding ToggleContentTemplateSelector}"
Focusable="False"
Visibility="{TemplateBinding ToggleCheckedContent, Converter={x:Static converters:NullableToVisibilityConverter.NotCollapsedInstance}}" />
<ContentControl x:Name="ExplicitToggleContent"
Content="{TemplateBinding ToggleContent}"
ContentTemplate="{TemplateBinding ToggleContentTemplate}"
ContentTemplateSelector="{TemplateBinding ToggleContentTemplateSelector}"
Focusable="False"
Visibility="{TemplateBinding ToggleCheckedContent, Converter={x:Static converters:NullableToVisibilityConverter.CollapsedInstance}}" />
<ContentControl x:Name="ExplicitToggleCheckedContent"
Content="{TemplateBinding ToggleCheckedContent}"
ContentTemplate="{TemplateBinding ToggleCheckedContentTemplate}"
Focusable="False"
Opacity="0"
RenderTransformOrigin=".5,.5"
Visibility="{TemplateBinding ToggleCheckedContent, Converter={x:Static converters:NullableToVisibilityConverter.CollapsedInstance}}">
<ContentControl.RenderTransform>
<RotateTransform Angle="-45" />
</ContentControl.RenderTransform>
</ContentControl>
</Grid>
</ToggleButton>
<wpf:PopupEx x:Name="PART_Popup"
AllowsTransparency="True"
CustomPopupPlacementCallback="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PopupPlacementMethod}"
IsOpen="False"
Placement="Custom"
PopupAnimation="{TemplateBinding PopupAnimation}">
<wpf:PopupEx.PlacementTarget>
<MultiBinding Converter="{x:Static converters:FirstNonNullConverter.Instance}">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="PlacementTarget" />
<Binding ElementName="PART_Toggle" />
</MultiBinding>
</wpf:PopupEx.PlacementTarget>
<Grid>
<!--
with PopupBox.PopupMode == MouseOverEager the popup is always open, with
content hidden. but Transparent doesn't seem to register hit test in the popup.
this opacity is the lowest I could get to register hit test. might try and speak
to MS about this one, I *think* it is a bug
-->
<Border Background="White" Opacity="0.002" />
<ContentControl x:Name="PART_PopupContentControl"
Content="{TemplateBinding PopupContent}"
ContentTemplate="{TemplateBinding PopupContentTemplate}"
Opacity="0"
Visibility="{TemplateBinding IsEnabled, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}">
<ContentControl.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}">
<Style.Setters>
<Setter Property="Margin" Value="16,4,16,4" />
</Style.Setters>
</Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
<Style.Setters>
<Setter Property="ToolTipService.Placement" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=(ToolTipService.Placement)}" />
<Setter Property="ToolTipService.InitialShowDelay" Value="0" />
<Setter Property="Margin" Value="4" />
</Style.Setters>
</Style>
</ResourceDictionary>
</ContentControl.Resources>
</ContentControl>
</Grid>
</wpf:PopupEx>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsPopupOpen" Value="True">
<Setter TargetName="PART_Popup" Property="IsOpen" Value="True" />
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Open}" />
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Close}" />
</Trigger.ExitActions>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="PopupMode" Value="MouseOverEager" />
<Condition Property="IsVisible" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="PART_Popup" Property="IsOpen" Value="True" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ToggleContent" Value="{StaticResource MaterialDesignMultiFloatingActionPopupBoxIcon}" />
<Setter Property="ToolTipService.IsEnabled" Value="False" />
<Setter Property="ToolTipService.Placement" Value="Left" />
<Setter Property="Width" Value="56" />
<Setter Property="wpf:ElevationAssist.Elevation" Value="Dp6" />
<Setter Property="wpf:RippleAssist.Feedback" Value="White" />
<Setter Property="wpf:RippleAssist.IsCentered" Value="True" />
<Style.Triggers>
<Trigger Property="UnfurlOrientation" Value="Horizontal">
<Setter Property="ToolTipService.Placement" Value="Custom" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="MaterialDesignMultiFloatingActionLightPopupBox"
TargetType="{x:Type wpf:PopupBox}"
BasedOn="{StaticResource MaterialDesignMultiFloatingActionPopupBox}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Light.Foreground}" />
</Style>
<Style x:Key="MaterialDesignMultiFloatingActionDarkPopupBox"
TargetType="{x:Type wpf:PopupBox}"
BasedOn="{StaticResource MaterialDesignMultiFloatingActionPopupBox}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark.Foreground}" />
</Style>
<Style x:Key="MaterialDesignMultiFloatingActionSecondaryPopupBox"
TargetType="{x:Type wpf:PopupBox}"
BasedOn="{StaticResource MaterialDesignMultiFloatingActionPopupBox}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary}" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Foreground}" />
</Style>
</ResourceDictionary>