Skip to content

Commit 580d5bd

Browse files
authored
Various changes for cards and shadows (#2765)
* Various changes for cards and shadows * add new depth lvl and mark old ones obselete * change default shadow depth on cards * adjust shadows * remove [Obselete] to fix the pipeline * add obselete attribute
1 parent 1fb94ea commit 580d5bd

File tree

6 files changed

+246
-22
lines changed

6 files changed

+246
-22
lines changed

MainDemo.Wpf/Shadows.xaml

Lines changed: 190 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
materialDesign:ShadowAssist.ShadowDepth="Depth4"
4949
Content="DEPTH 4"/>
5050
</smtx:XamlDisplay>
51-
51+
5252
<smtx:XamlDisplay UniqueKey="shadow_5" Margin="16 0 0 0">
5353
<Button
5454
Style="{StaticResource MaterialDesignRaisedButton}"
@@ -60,15 +60,15 @@
6060
<StackPanel
6161
Orientation="Horizontal"
6262
Margin="0 32 0 0">
63-
<smtx:XamlDisplay UniqueKey="shadow_6">
63+
<smtx:XamlDisplay UniqueKey="shadow_9">
6464
<Button
6565
Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
6666
materialDesign:ShadowAssist.ShadowDepth="Depth1"
6767
Content="1"/>
6868
</smtx:XamlDisplay>
6969

7070
<smtx:XamlDisplay
71-
UniqueKey="shadow_7"
71+
UniqueKey="shadow_10"
7272
Margin="16 0 0 0">
7373
<Button
7474
Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
@@ -77,7 +77,7 @@
7777
</smtx:XamlDisplay>
7878

7979
<smtx:XamlDisplay
80-
UniqueKey="shadow_8"
80+
UniqueKey="shadow_11"
8181
Margin="16 0 0 0">
8282
<Button
8383
Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
@@ -86,16 +86,16 @@
8686
</smtx:XamlDisplay>
8787

8888
<smtx:XamlDisplay
89-
UniqueKey="shadow_9"
89+
UniqueKey="shadow_12"
9090
Margin="16 0 0 0">
9191
<Button
9292
Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
9393
materialDesign:ShadowAssist.ShadowDepth="Depth4"
9494
Content="4"/>
9595
</smtx:XamlDisplay>
96-
96+
9797
<smtx:XamlDisplay
98-
UniqueKey="shadow_10"
98+
UniqueKey="shadow_13"
9999
Margin="16 0 0 0">
100100
<Button
101101
Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
@@ -107,15 +107,15 @@
107107
<StackPanel
108108
Orientation="Horizontal"
109109
Margin="0 32 0 0">
110-
<smtx:XamlDisplay UniqueKey="shadow_11">
110+
<smtx:XamlDisplay UniqueKey="shadow_17">
111111
<materialDesign:Card
112112
materialDesign:ShadowAssist.ShadowDepth="Depth1"
113113
Padding="32"
114114
Content="DEPTH 1"/>
115115
</smtx:XamlDisplay>
116116

117117
<smtx:XamlDisplay
118-
UniqueKey="shadow_12"
118+
UniqueKey="shadow_18"
119119
Margin="16 0 0 0">
120120
<materialDesign:Card
121121
materialDesign:ShadowAssist.ShadowDepth="Depth2"
@@ -124,7 +124,7 @@
124124
</smtx:XamlDisplay>
125125

126126
<smtx:XamlDisplay
127-
UniqueKey="shadow_13"
127+
UniqueKey="shadow_19"
128128
Margin="16 0 0 0">
129129
<materialDesign:Card
130130
materialDesign:ShadowAssist.ShadowDepth="Depth3"
@@ -133,16 +133,16 @@
133133
</smtx:XamlDisplay>
134134

135135
<smtx:XamlDisplay
136-
UniqueKey="shadow_14"
136+
UniqueKey="shadow_20"
137137
Margin="16 0 0 0">
138138
<materialDesign:Card
139139
materialDesign:ShadowAssist.ShadowDepth="Depth4"
140140
Padding="32"
141141
Content="DEPTH 4"/>
142142
</smtx:XamlDisplay>
143-
143+
144144
<smtx:XamlDisplay
145-
UniqueKey="shadow_15"
145+
UniqueKey="shadow_21"
146146
Margin="16 0 0 0">
147147
<materialDesign:Card
148148
materialDesign:ShadowAssist.ShadowDepth="Depth5"
@@ -154,7 +154,7 @@
154154
<StackPanel
155155
Orientation="Horizontal"
156156
Margin="0 32 0 0">
157-
<smtx:XamlDisplay UniqueKey="shadow_16">
157+
<smtx:XamlDisplay UniqueKey="shadow_26">
158158
<materialDesign:Card
159159
materialDesign:ShadowAssist.ShadowDepth="Depth3"
160160
materialDesign:ShadowAssist.ShadowEdges="Bottom,Right"
@@ -163,7 +163,7 @@
163163
</smtx:XamlDisplay>
164164

165165
<smtx:XamlDisplay
166-
UniqueKey="shadow_17"
166+
UniqueKey="shadow_27"
167167
Margin="16 0 0 0">
168168
<materialDesign:Card
169169
materialDesign:ShadowAssist.ShadowDepth="Depth3"
@@ -173,7 +173,7 @@
173173
</smtx:XamlDisplay>
174174

175175
<smtx:XamlDisplay
176-
UniqueKey="shadow_18"
176+
UniqueKey="shadow_28"
177177
Margin="16 0 0 0">
178178
<materialDesign:Card
179179
materialDesign:ShadowAssist.ShadowDepth="Depth3"
@@ -182,6 +182,180 @@
182182
Content="CUSTOM CLIP"/>
183183
</smtx:XamlDisplay>
184184
</StackPanel>
185+
<TextBlock Style="{DynamicResource MaterialDesignHeadline5TextBlock}" Margin="0,45,0,10">
186+
New Depth Shadow System
187+
</TextBlock>
188+
<Separator Style="{DynamicResource MaterialDesignSeparator}" Margin="0,0,0,16"/>
189+
<WrapPanel Orientation="Horizontal">
190+
<smtx:XamlDisplay
191+
UniqueKey="new_shadow_card_0dp"
192+
Margin="0,0,16,32">
193+
<materialDesign:Card
194+
materialDesign:ShadowAssist.ShadowDepth="Depth_0dp"
195+
Width="150"
196+
Height="80">
197+
<TextBlock
198+
HorizontalAlignment="Center"
199+
VerticalAlignment="Center">
200+
Depth 0dp
201+
</TextBlock>
202+
</materialDesign:Card>
203+
</smtx:XamlDisplay>
204+
<smtx:XamlDisplay
205+
UniqueKey="new_shadow_card_1dp"
206+
Margin="0,0,16,32">
207+
<materialDesign:Card
208+
materialDesign:ShadowAssist.ShadowDepth="Depth_1dp"
209+
Width="150"
210+
Height="80">
211+
<TextBlock
212+
HorizontalAlignment="Center"
213+
VerticalAlignment="Center">
214+
Depth 1dp
215+
</TextBlock>
216+
</materialDesign:Card>
217+
</smtx:XamlDisplay>
218+
<smtx:XamlDisplay
219+
UniqueKey="new_shadow_card_2dp"
220+
Margin="0,0,16,32">
221+
<materialDesign:Card
222+
materialDesign:ShadowAssist.ShadowDepth="Depth_2dp"
223+
Width="150"
224+
Height="80">
225+
<TextBlock
226+
HorizontalAlignment="Center"
227+
VerticalAlignment="Center">
228+
Depth 2dp
229+
</TextBlock>
230+
</materialDesign:Card>
231+
</smtx:XamlDisplay>
232+
<smtx:XamlDisplay
233+
UniqueKey="new_shadow_card_3dp"
234+
Margin="0,0,16,32">
235+
<materialDesign:Card
236+
materialDesign:ShadowAssist.ShadowDepth="Depth_3dp"
237+
Width="150"
238+
Height="80">
239+
<TextBlock
240+
HorizontalAlignment="Center"
241+
VerticalAlignment="Center">
242+
Depth 3dp
243+
</TextBlock>
244+
</materialDesign:Card>
245+
</smtx:XamlDisplay>
246+
<smtx:XamlDisplay
247+
UniqueKey="new_shadow_card_4dp"
248+
Margin="0,0,16,32">
249+
<materialDesign:Card
250+
materialDesign:ShadowAssist.ShadowDepth="Depth_4dp"
251+
Width="150"
252+
Height="80">
253+
<TextBlock
254+
HorizontalAlignment="Center"
255+
VerticalAlignment="Center">
256+
Depth 4dp
257+
</TextBlock>
258+
</materialDesign:Card>
259+
</smtx:XamlDisplay>
260+
<smtx:XamlDisplay
261+
UniqueKey="new_shadow_card_5dp"
262+
Margin="0,0,16,32">
263+
<materialDesign:Card
264+
materialDesign:ShadowAssist.ShadowDepth="Depth_5dp"
265+
Width="150"
266+
Height="80">
267+
<TextBlock
268+
HorizontalAlignment="Center"
269+
VerticalAlignment="Center">
270+
Depth 5dp
271+
</TextBlock>
272+
</materialDesign:Card>
273+
</smtx:XamlDisplay>
274+
<smtx:XamlDisplay
275+
UniqueKey="new_shadow_card_6dp"
276+
Margin="0,0,16,32">
277+
<materialDesign:Card
278+
materialDesign:ShadowAssist.ShadowDepth="Depth_6dp"
279+
Width="150"
280+
Height="80">
281+
<TextBlock
282+
HorizontalAlignment="Center"
283+
VerticalAlignment="Center">
284+
Depth 6dp
285+
</TextBlock>
286+
</materialDesign:Card>
287+
</smtx:XamlDisplay>
288+
<smtx:XamlDisplay
289+
UniqueKey="new_shadow_card_7dp"
290+
Margin="0,0,16,32">
291+
<materialDesign:Card
292+
materialDesign:ShadowAssist.ShadowDepth="Depth_7dp"
293+
Width="150"
294+
Height="80">
295+
<TextBlock
296+
HorizontalAlignment="Center"
297+
VerticalAlignment="Center">
298+
Depth 7dp
299+
</TextBlock>
300+
</materialDesign:Card>
301+
</smtx:XamlDisplay>
302+
<smtx:XamlDisplay
303+
UniqueKey="new_shadow_card_8dp"
304+
Margin="0,0,16,32">
305+
<materialDesign:Card
306+
materialDesign:ShadowAssist.ShadowDepth="Depth_8dp"
307+
Width="150"
308+
Height="80">
309+
<TextBlock
310+
HorizontalAlignment="Center"
311+
VerticalAlignment="Center">
312+
Depth 8dp
313+
</TextBlock>
314+
</materialDesign:Card>
315+
</smtx:XamlDisplay>
316+
<smtx:XamlDisplay
317+
UniqueKey="new_shadow_card_12dp"
318+
Margin="0,0,16,32">
319+
<materialDesign:Card
320+
materialDesign:ShadowAssist.ShadowDepth="Depth_12dp"
321+
Width="150"
322+
Height="80">
323+
<TextBlock
324+
HorizontalAlignment="Center"
325+
VerticalAlignment="Center">
326+
Depth 12dp
327+
</TextBlock>
328+
</materialDesign:Card>
329+
</smtx:XamlDisplay>
330+
<smtx:XamlDisplay
331+
UniqueKey="new_shadow_card_16"
332+
Margin="0,0,16,32">
333+
<materialDesign:Card
334+
materialDesign:ShadowAssist.ShadowDepth="Depth_16dp"
335+
Width="150"
336+
Height="80">
337+
<TextBlock
338+
HorizontalAlignment="Center"
339+
VerticalAlignment="Center">
340+
Depth 16dp
341+
</TextBlock>
342+
</materialDesign:Card>
343+
</smtx:XamlDisplay>
344+
<smtx:XamlDisplay
345+
UniqueKey="new_shadow_card_24"
346+
Margin="0,0,16,32">
347+
<materialDesign:Card
348+
materialDesign:ShadowAssist.ShadowDepth="Depth_24dp"
349+
Width="150"
350+
Height="80">
351+
<TextBlock
352+
HorizontalAlignment="Center"
353+
VerticalAlignment="Center">
354+
Depth 24dp
355+
</TextBlock>
356+
</materialDesign:Card>
357+
</smtx:XamlDisplay>
358+
</WrapPanel>
185359
</StackPanel>
186360
</UserControl>
187361

MaterialDesignThemes.Wpf/Card.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace MaterialDesignThemes.Wpf
99
public class Card : ContentControl
1010
{
1111
private Border? _clipBorder;
12-
private const double DefaultUniformCornerRadius = 2.0;
12+
private const double DefaultUniformCornerRadius = 4.0;
1313
public const string ClipBorderPartName = "PART_ClipBorder";
1414

1515
#region DependencyProperty : UniformCornerRadiusProperty

MaterialDesignThemes.Wpf/Converters/ShadowInfo.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,30 @@ static ShadowInfo()
1515

1616
ShadowsDictionary = new Dictionary<ShadowDepth, DropShadowEffect?>
1717
{
18+
// Obselete
19+
#region ObseleteDepth
20+
#pragma warning disable CS0618 // Type or member is obsolete
1821
{ ShadowDepth.Depth0, null },
1922
{ ShadowDepth.Depth1, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth1"] },
2023
{ ShadowDepth.Depth2, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth2"] },
2124
{ ShadowDepth.Depth3, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth3"] },
2225
{ ShadowDepth.Depth4, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth4"] },
2326
{ ShadowDepth.Depth5, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth5"] },
27+
#pragma warning restore CS0618 // Type or member is obsolete
28+
#endregion
29+
30+
{ ShadowDepth.Depth_0dp, null },
31+
{ ShadowDepth.Depth_1dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_1dp"] },
32+
{ ShadowDepth.Depth_2dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_2dp"] },
33+
{ ShadowDepth.Depth_3dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_3dp"] },
34+
{ ShadowDepth.Depth_4dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_4dp"] },
35+
{ ShadowDepth.Depth_5dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_5dp"] },
36+
{ ShadowDepth.Depth_6dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_6dp"] },
37+
{ ShadowDepth.Depth_7dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_7dp"] },
38+
{ ShadowDepth.Depth_8dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_8dp"] },
39+
{ ShadowDepth.Depth_12dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_12dp"] },
40+
{ ShadowDepth.Depth_16dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_16dp"] },
41+
{ ShadowDepth.Depth_24dp, (DropShadowEffect)resourceDictionary["MaterialDesignShadowDepth_24dp"] }
2442
};
2543
}
2644

MaterialDesignThemes.Wpf/ShadowAssist.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,31 @@ namespace MaterialDesignThemes.Wpf
1111

1212
public enum ShadowDepth
1313
{
14+
[Obsolete("Use Depth_0dp instead")]
1415
Depth0,
16+
[Obsolete("Considersing Depth_2dp instead")]
1517
Depth1,
18+
[Obsolete("Considersing Depth_3dp instead")]
1619
Depth2,
20+
[Obsolete("Considersing Depth_7dp instead")]
1721
Depth3,
22+
[Obsolete("Considersing Depth_12dp instead")]
1823
Depth4,
19-
Depth5
24+
[Obsolete("Considersing Depth_24dp instead")]
25+
Depth5,
26+
27+
Depth_0dp,
28+
Depth_1dp,
29+
Depth_2dp,
30+
Depth_3dp,
31+
Depth_4dp,
32+
Depth_5dp,
33+
Depth_6dp,
34+
Depth_7dp,
35+
Depth_8dp,
36+
Depth_12dp,
37+
Depth_16dp,
38+
Depth_24dp
2039
}
2140

2241
[Flags]

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Card.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<Style x:Key="MaterialDesignElevatedCard" TargetType="{x:Type wpf:Card}">
1111
<Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}" />
12-
<Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth2" />
12+
<Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth_1dp" />
1313
<Setter Property="Focusable" Value="False"/>
1414
<Setter Property="Template">
1515
<Setter.Value>

0 commit comments

Comments
 (0)