Skip to content

Commit cfac877

Browse files
committed
Merge pull request #34 from punker76/Shadows-usage
Shadows usage
2 parents 5054b4f + a51f12c commit cfac877

11 files changed

+29
-46
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Button.xaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
<Setter.Value>
3131
<ControlTemplate TargetType="{x:Type Button}">
3232
<Grid>
33-
<Border Background="{TemplateBinding Background}">
34-
<Border.Effect>
35-
<DropShadowEffect BlurRadius="5" ShadowDepth="1" Direction="270" Color="#CCCCCC" />
36-
</Border.Effect>
37-
</Border>
33+
<Border Background="{TemplateBinding Background}" Effect="{DynamicResource MaterialDesignShadowDepth1}" />
3834
<Border Background="{TemplateBinding Background}" x:Name="border" CornerRadius="2">
3935
<wpf:VisualFeedbackContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False"
4036
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -131,12 +127,8 @@
131127
<Setter.Value>
132128
<ControlTemplate TargetType="{x:Type Button}">
133129
<Grid>
134-
<Ellipse Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"
135-
x:Name="border">
136-
<Ellipse.Effect>
137-
<DropShadowEffect BlurRadius="5" ShadowDepth="1" Direction="270" Color="#CCCCCC"/>
138-
</Ellipse.Effect>
139-
</Ellipse>
130+
<Ellipse Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Effect="{DynamicResource MaterialDesignShadowDepth1}"
131+
x:Name="border" />
140132
<wpf:VisualFeedbackContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False"
141133
Clip="{Binding ElementName=GeometryEllipse, Path=RenderedGeometry}" ClipToBounds="True"
142134
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Card.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
44
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters">
55

6-
<ResourceDictionary.MergedDictionaries>
7-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
8-
</ResourceDictionary.MergedDictionaries>
9-
106
<converters:CardClipConverter x:Key="CardClipConverter" />
117

128
<ControlTemplate TargetType="{x:Type wpf:Card}" x:Key="CardTemplate">
139
<Border Margin="{TemplateBinding Margin}"
14-
Effect="{StaticResource MaterialDesignShadowDepth2}"
10+
Effect="{DynamicResource MaterialDesignShadowDepth2}"
1511
CornerRadius="{TemplateBinding UniformCornerRadius}" Background="Transparent">
1612
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"
1713
x:Name="PART_ClipBorder"

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@
154154
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
155155
<Border x:Name="shadow" Background="{DynamicResource MaterialDesignPaper}" CornerRadius="2"
156156
MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
157-
BorderThickness="1" BorderBrush="{DynamicResource MaterialDesignDivider}">
158-
<Border.Effect>
159-
<DropShadowEffect BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="Black" Opacity=".23"/>
160-
</Border.Effect>
157+
BorderThickness="1" BorderBrush="{DynamicResource MaterialDesignDivider}" Effect="{DynamicResource MaterialDesignShadowDepth2}">
161158
<Border x:Name="dropDownBorder" Background="Transparent">
162159
<ScrollViewer x:Name="DropDownScrollViewer">
163160
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
@@ -240,10 +237,7 @@
240237
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
241238
<Border x:Name="dropDownBorder" BorderBrush="{DynamicResource MaterialDesignDivider}" BorderThickness="1" Background="{DynamicResource MaterialDesignPaper}"
242239
CornerRadius="2"
243-
MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
244-
<Border.Effect>
245-
<DropShadowEffect BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="Black" Opacity=".23"/>
246-
</Border.Effect>
240+
MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" Effect="{DynamicResource MaterialDesignShadowDepth2}">
247241
<ScrollViewer x:Name="DropDownScrollViewer">
248242
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
249243
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@
1414

1515
<SolidColorBrush x:Key="MaterialDesignDivider" Color="#616161" />
1616
<SolidColorBrush x:Key="MaterialDesignSelection" Color="#757575" />
17-
17+
18+
<Color x:Key="MaterialDesignShadow1">#CCCCCC</Color>
19+
<Color x:Key="MaterialDesignShadow2">#C4C4C4</Color>
20+
<Color x:Key="MaterialDesignShadow3">#BBBBBB</Color>
21+
<Color x:Key="MaterialDesignShadow4">#BBBBBB</Color>
22+
<Color x:Key="MaterialDesignShadow5">#BBBBBB</Color>
23+
1824
</ResourceDictionary>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<ResourceDictionary.MergedDictionaries>
66
<ResourceDictionary Source="MaterialDesignTheme.Calendar.xaml" />
7-
<ResourceDictionary Source="MaterialDesignTheme.Shadows.xaml" />
87
</ResourceDictionary.MergedDictionaries>
98

109
<Style x:Key="MaterialDesignDatePickerTextBox" TargetType="{x:Type DatePickerTextBox}">
@@ -67,7 +66,7 @@
6766
<Setter Property="Template">
6867
<Setter.Value>
6968
<ControlTemplate TargetType="{x:Type Calendar}">
70-
<Border Effect="{StaticResource MaterialDesignShadowDepth4}" Padding="16 8 16 24">
69+
<Border Effect="{DynamicResource MaterialDesignShadowDepth4}" Padding="16 8 16 24">
7170
<CalendarItem x:Name="PART_CalendarItem" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Style="{DynamicResource MaterialDesignCalendarItemPortrait}"
7271
/>
7372
</Border>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<!-- use this resource dictionary to set up the most common themese for standard controls -->
55

66
<ResourceDictionary.MergedDictionaries>
7+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
78
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.button.xaml" />
89
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.calendar.xaml" />
910
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.checkbox.xaml" />

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@
1414
<SolidColorBrush x:Key="MaterialDesignDivider" Color="#eeeeee" />
1515
<SolidColorBrush x:Key="MaterialDesignSelection" Color="#e0e0e0" />
1616

17+
<Color x:Key="MaterialDesignShadow1">#CCCCCC</Color>
18+
<Color x:Key="MaterialDesignShadow2">#C4C4C4</Color>
19+
<Color x:Key="MaterialDesignShadow3">#BBBBBB</Color>
20+
<Color x:Key="MaterialDesignShadow4">#BBBBBB</Color>
21+
<Color x:Key="MaterialDesignShadow5">#BBBBBB</Color>
22+
1723
</ResourceDictionary>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@
9292
<ControlTemplate TargetType="{x:Type ListBoxItem}">
9393
<Grid>
9494
<Border CornerRadius="2"
95-
Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
96-
<Border.Effect>
97-
<DropShadowEffect BlurRadius="8" ShadowDepth="2.5" Direction="270" Color="Black" Opacity=".23"/>
98-
</Border.Effect>
99-
</Border>
95+
Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true" Effect="{DynamicResource MaterialDesignShadowDepth2}" />
10096
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
10197
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"
10298
CornerRadius="2"/>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Shadows.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
<!-- thanks: http://marcangers.com/material-design-shadows-in-wpf/ -->
55

6-
<DropShadowEffect x:Key="MaterialDesignShadowDepth1" BlurRadius="5" ShadowDepth="1" Direction="270" Color="#CCCCCC"/>
7-
<DropShadowEffect x:Key="MaterialDesignShadowDepth2" BlurRadius="8" ShadowDepth="2.5" Direction="270" Color="#BBBBBB"/>
8-
<DropShadowEffect x:Key="MaterialDesignShadowDepth3" BlurRadius="14" ShadowDepth="4.5" Direction="270" Color="#BBBBBB"/>
9-
<DropShadowEffect x:Key="MaterialDesignShadowDepth4" BlurRadius="25" ShadowDepth="8" Direction="270" Color="#BBBBBB"/>
10-
<DropShadowEffect x:Key="MaterialDesignShadowDepth5" BlurRadius="35" ShadowDepth="13" Direction="270" Color="#BBBBBB"/>
6+
<DropShadowEffect x:Key="MaterialDesignShadowDepth1" BlurRadius="5" ShadowDepth="1" Direction="270" Color="{DynamicResource MaterialDesignShadow1}"/>
7+
<DropShadowEffect x:Key="MaterialDesignShadowDepth2" BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="{DynamicResource MaterialDesignShadow2}"/>
8+
<DropShadowEffect x:Key="MaterialDesignShadowDepth3" BlurRadius="14" ShadowDepth="4.5" Direction="270" Color="{DynamicResource MaterialDesignShadow3}"/>
9+
<DropShadowEffect x:Key="MaterialDesignShadowDepth4" BlurRadius="25" ShadowDepth="8" Direction="270" Color="{DynamicResource MaterialDesignShadow4}"/>
10+
<DropShadowEffect x:Key="MaterialDesignShadowDepth5" BlurRadius="35" ShadowDepth="13" Direction="270" Color="{DynamicResource MaterialDesignShadow5}"/>
1111

1212
</ResourceDictionary>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TimePicker.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
44
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters">
55

6-
<ResourceDictionary.MergedDictionaries>
7-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
8-
</ResourceDictionary.MergedDictionaries>
9-
106
<converters:TextFieldHintVisibilityConverter x:Key="TextFieldHintVisibilityConverter" />
117

128
<Style x:Key="MaterialDesignTimePicker" TargetType="{x:Type wpf:TimePicker}">
@@ -25,7 +21,7 @@
2521
<Setter Property="Template">
2622
<Setter.Value>
2723
<ControlTemplate TargetType="{x:Type ContentControl}">
28-
<Border Effect="{StaticResource MaterialDesignShadowDepth4}" Padding="16 8 16 24">
24+
<Border Effect="{DynamicResource MaterialDesignShadowDepth4}" Padding="16 8 16 24">
2925
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" />
3026
</Border>
3127
</ControlTemplate>

0 commit comments

Comments
 (0)