Skip to content

Commit 0ecc70e

Browse files
authored
Fixing the overlay background colors to properly get set in the storyboards. (#1069)
This fixes the Live Visual Tree selection issue as well as the animate out issue.
1 parent 154e19b commit 0ecc70e

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
</EasingDoubleKeyFrame>
515515
</DoubleAnimationUsingKeyFrames>
516516
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCover"
517-
Storyboard.TargetProperty="Background">
517+
Storyboard.TargetProperty="Background">
518518
<DiscreteObjectKeyFrame Value="{StaticResource BlackBackground}" KeyTime="0" />
519519
</ObjectAnimationUsingKeyFrames>
520520
</Storyboard>
@@ -529,6 +529,10 @@
529529
</EasingDoubleKeyFrame.EasingFunction>
530530
</EasingDoubleKeyFrame>
531531
</DoubleAnimationUsingKeyFrames>
532+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCover"
533+
Storyboard.TargetProperty="Background">
534+
<DiscreteObjectKeyFrame Value="{x:Null}" KeyTime="0:0:0.3" />
535+
</ObjectAnimationUsingKeyFrames>
532536
</Storyboard>
533537
</VisualTransition>
534538
</VisualStateGroup.Transitions>
@@ -551,10 +555,14 @@
551555
<VisualState x:Name="AllClosed">
552556
<Storyboard>
553557
<DoubleAnimation Storyboard.TargetName="PART_ContentCover" Storyboard.TargetProperty="Opacity"
554-
To="0" />
558+
To="0" />
555559
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCover" Storyboard.TargetProperty="IsHitTestVisible">
556560
<DiscreteBooleanKeyFrame Value="False" />
557561
</BooleanAnimationUsingKeyFrames>
562+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCover"
563+
Storyboard.TargetProperty="Background">
564+
<DiscreteObjectKeyFrame Value="{x:Null}" />
565+
</ObjectAnimationUsingKeyFrames>
558566
</Storyboard>
559567
</VisualState>
560568
</VisualStateGroup>
@@ -745,7 +753,7 @@
745753
x:Name="ContentPresenter" Opacity="1"
746754
Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentStringFormat="{TemplateBinding ContentStringFormat}" />
747755
</AdornerDecorator>
748-
<Grid x:Name="PART_ContentCover" Background="Black" Opacity="0" IsHitTestVisible="False" Focusable="False" />
756+
<Grid x:Name="PART_ContentCover" Background="{x:Null}" Opacity="0" IsHitTestVisible="False" Focusable="False" />
749757
<Grid>
750758
<Grid HorizontalAlignment="Left" VerticalAlignment="Stretch"
751759
x:Name="PART_LeftDrawer"

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DialogHost.xaml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<Setter Property="Placement" Value="Center" />
1414
</Style>
1515

16+
<SolidColorBrush x:Key="BlackBackground" Color="Black" />
17+
1618
<Style TargetType="{x:Type wpf:DialogHost}">
1719
<Setter Property="DialogMargin" Value="35" />
1820
<Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth5" />
@@ -30,6 +32,10 @@
3032
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="IsOpen">
3133
<DiscreteBooleanKeyFrame Value="True" KeyTime="0" />
3234
</BooleanAnimationUsingKeyFrames>
35+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
36+
Storyboard.TargetProperty="Background">
37+
<DiscreteObjectKeyFrame Value="{StaticResource BlackBackground}" KeyTime="0" />
38+
</ObjectAnimationUsingKeyFrames>
3339
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity">
3440
<EasingDoubleKeyFrame Value="0" KeyTime="0" />
3541
<EasingDoubleKeyFrame Value="0.56" KeyTime="0:0:0.3">
@@ -69,6 +75,10 @@
6975
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="IsOpen">
7076
<DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0.3" />
7177
</BooleanAnimationUsingKeyFrames>
78+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
79+
Storyboard.TargetProperty="Background">
80+
<DiscreteObjectKeyFrame Value="{x:Null}" KeyTime="0:0:0.3" />
81+
</ObjectAnimationUsingKeyFrames>
7282
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity">
7383
<EasingDoubleKeyFrame Value="0.56" KeyTime="0" />
7484
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.3">
@@ -112,6 +122,10 @@
112122
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="IsOpen">
113123
<DiscreteBooleanKeyFrame Value="True" KeyTime="0" />
114124
</BooleanAnimationUsingKeyFrames>
125+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
126+
Storyboard.TargetProperty="Background">
127+
<DiscreteObjectKeyFrame Value="{StaticResource BlackBackground}" />
128+
</ObjectAnimationUsingKeyFrames>
115129
<DoubleAnimation Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity"
116130
Duration="0"
117131
To=".56" />
@@ -131,6 +145,12 @@
131145
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="IsOpen">
132146
<DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0.3" />
133147
</BooleanAnimationUsingKeyFrames>
148+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
149+
Storyboard.TargetProperty="Background">
150+
<DiscreteObjectKeyFrame Value="{x:Null}" />
151+
</ObjectAnimationUsingKeyFrames>
152+
<DoubleAnimation Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity"
153+
To="0" />
134154
</Storyboard>
135155
</VisualState>
136156
</VisualStateGroup>
@@ -177,7 +197,6 @@
177197
<ControlTemplate.Triggers>
178198
<Trigger Property="IsOpen" Value="True">
179199
<Setter TargetName="ContentPresenter" Property="IsEnabled" Value="False" />
180-
<Setter TargetName="PART_ContentCoverGrid" Property="Background" Value="Black" />
181200
<Setter TargetName="PART_ContentCoverGrid" Property="IsHitTestVisible" Value="True" />
182201
</Trigger>
183202
</ControlTemplate.Triggers>
@@ -203,6 +222,10 @@
203222
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="Visibility">
204223
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0" />
205224
</ObjectAnimationUsingKeyFrames>
225+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
226+
Storyboard.TargetProperty="Background">
227+
<DiscreteObjectKeyFrame Value="{StaticResource BlackBackground}" KeyTime="0" />
228+
</ObjectAnimationUsingKeyFrames>
206229
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity">
207230
<EasingDoubleKeyFrame Value="0" KeyTime="0" />
208231
<EasingDoubleKeyFrame Value="0.56" KeyTime="0:0:0.3">
@@ -242,6 +265,10 @@
242265
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="Visibility">
243266
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.3" />
244267
</ObjectAnimationUsingKeyFrames>
268+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
269+
Storyboard.TargetProperty="Background">
270+
<DiscreteObjectKeyFrame Value="{x:Null}" KeyTime="0:0:0.3" />
271+
</ObjectAnimationUsingKeyFrames>
245272
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity">
246273
<EasingDoubleKeyFrame Value="0.56" KeyTime="0" />
247274
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.3">
@@ -285,6 +312,10 @@
285312
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="Visibility">
286313
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0" />
287314
</ObjectAnimationUsingKeyFrames>
315+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
316+
Storyboard.TargetProperty="Background">
317+
<DiscreteObjectKeyFrame Value="{StaticResource BlackBackground}" KeyTime="0" />
318+
</ObjectAnimationUsingKeyFrames>
288319
<DoubleAnimation Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity"
289320
Duration="0"
290321
To=".56" />
@@ -302,8 +333,14 @@
302333
<VisualState x:Name="Closed">
303334
<Storyboard>
304335
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Popup" Storyboard.TargetProperty="Visibility">
305-
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.3" />
336+
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0" />
337+
</ObjectAnimationUsingKeyFrames>
338+
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentCoverGrid"
339+
Storyboard.TargetProperty="Background">
340+
<DiscreteObjectKeyFrame Value="{x:Null}" />
306341
</ObjectAnimationUsingKeyFrames>
342+
<DoubleAnimation Storyboard.TargetName="PART_ContentCoverGrid" Storyboard.TargetProperty="Opacity"
343+
To="0" />
307344
</Storyboard>
308345
</VisualState>
309346
</VisualStateGroup>

0 commit comments

Comments
 (0)