Skip to content

Commit 53876b5

Browse files
committed
support shadow assist on colour zones
1 parent 58a260f commit 53876b5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

MainDemo.Wpf/ColorZones.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
</StackPanel>
7979
</wpf:ColorZone>
8080
<TextBlock Margin="0 16 0 0" FontSize="10">Add in a corner radius and shadow.</TextBlock>
81-
<wpf:ColorZone Mode="PrimaryDark" Padding="16" CornerRadius="3" Effect="{DynamicResource MaterialDesignShadowDepth3}" Margin="2">
81+
<wpf:ColorZone Mode="PrimaryDark" Padding="16" CornerRadius="3" wpf:ShadowAssist.ShadowDepth="Depth3" Margin="2">
8282
<StackPanel Orientation="Horizontal">
8383
<ToggleButton Style="{DynamicResource MaterialDesignHamburgerToggleButton}" />
8484
<TextBlock VerticalAlignment="Center" Margin="16 0 0 0">Material Design In XAML Toolkit</TextBlock>

MaterialDesignThemes.Wpf/Converters/ShadowConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ static ShadowConverter()
3030

3131
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
3232
{
33+
if (!(value is ShadowDepth)) return null;
34+
3335
return ShadowsDictionary[(ShadowDepth) value];
3436
}
3537

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,15 @@
354354
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
355355
<Setter Property="VerticalAlignment" Value="Top" />
356356
<Setter Property="IsTabStop" Value="False" />
357+
<Setter Property="Effect" Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:ShadowAssist.ShadowDepth), Converter={x:Static converters:ShadowConverter.Instance}}" />
357358
<Setter Property="Template">
358359
<Setter.Value>
359360
<ControlTemplate TargetType="{x:Type local:ColorZone}">
360361
<Border Background="{TemplateBinding Background}"
361362
BorderBrush="{TemplateBinding BorderBrush}"
362363
BorderThickness="{TemplateBinding BorderThickness}"
363364
CornerRadius="{TemplateBinding CornerRadius}"
364-
ClipToBounds="True"
365+
ClipToBounds="True"
365366
>
366367
<ContentPresenter Content="{TemplateBinding Content}"
367368
ContentTemplate="{TemplateBinding ContentTemplate}"

0 commit comments

Comments
 (0)