|
7 | 7 | <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
|
8 | 8 | </ResourceDictionary.MergedDictionaries>
|
9 | 9 |
|
10 |
| - <ControlTemplate TargetType="{x:Type wpf:Card}" x:Key="CardTemplate"> |
11 |
| - <ControlTemplate.Resources> |
12 |
| - <converters:ShadowEdgeConverter x:Key="ShadowEdgeConverter" /> |
13 |
| - </ControlTemplate.Resources> |
14 |
| - <Grid Background="Transparent"> |
15 |
| - <AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}"> |
16 |
| - <AdornerDecorator.OpacityMask> |
17 |
| - <MultiBinding Converter="{StaticResource ShadowEdgeConverter}"> |
18 |
| - <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ActualWidth"/> |
19 |
| - <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ActualHeight"/> |
20 |
| - <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:ShadowAssist.ShadowDepth)" /> |
21 |
| - <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:ShadowAssist.ShadowEdges)" /> |
22 |
| - </MultiBinding> |
23 |
| - </AdornerDecorator.OpacityMask> |
24 |
| - <Border Effect="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ShadowAssist.ShadowDepth), Converter={x:Static converters:ShadowConverter.Instance}}" |
25 |
| - CornerRadius="{TemplateBinding UniformCornerRadius}"> |
26 |
| - <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" |
27 |
| - x:Name="PART_ClipBorder" |
28 |
| - Clip="{TemplateBinding ContentClip}" /> |
29 |
| - </Border> |
30 |
| - </AdornerDecorator> |
31 |
| - <ContentPresenter |
32 |
| - x:Name="ContentPresenter" |
33 |
| - Margin="{TemplateBinding Padding}" |
34 |
| - Content="{TemplateBinding ContentControl.Content}" |
35 |
| - ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" |
36 |
| - ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" |
37 |
| - ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"> |
38 |
| - </ContentPresenter> |
39 |
| - </Grid> |
40 |
| - <ControlTemplate.Triggers> |
41 |
| - <Trigger Property="ClipContent" Value="True"> |
42 |
| - <Setter Property="Clip" TargetName="ContentPresenter" Value="{Binding ContentClip, RelativeSource={RelativeSource TemplatedParent}}" /> |
43 |
| - </Trigger> |
44 |
| - </ControlTemplate.Triggers> |
45 |
| - </ControlTemplate> |
46 |
| - <Style TargetType="{x:Type wpf:Card}"> |
47 |
| - <Setter Property="Template" Value="{StaticResource CardTemplate}" /> |
| 10 | + <Style x:Key="MaterialDesignElevatedCard" TargetType="{x:Type wpf:Card}"> |
48 | 11 | <Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}" />
|
49 | 12 | <Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth2" />
|
50 | 13 | <Setter Property="Focusable" Value="False"/>
|
| 14 | + <Setter Property="Template"> |
| 15 | + <Setter.Value> |
| 16 | + <ControlTemplate TargetType="{x:Type wpf:Card}"> |
| 17 | + <ControlTemplate.Resources> |
| 18 | + <converters:ShadowEdgeConverter x:Key="ShadowEdgeConverter" /> |
| 19 | + </ControlTemplate.Resources> |
| 20 | + <Grid Background="Transparent"> |
| 21 | + <AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}"> |
| 22 | + <AdornerDecorator.OpacityMask> |
| 23 | + <MultiBinding Converter="{StaticResource ShadowEdgeConverter}"> |
| 24 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ActualWidth"/> |
| 25 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ActualHeight"/> |
| 26 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:ShadowAssist.ShadowDepth)" /> |
| 27 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:ShadowAssist.ShadowEdges)" /> |
| 28 | + </MultiBinding> |
| 29 | + </AdornerDecorator.OpacityMask> |
| 30 | + <Border Effect="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ShadowAssist.ShadowDepth), Converter={x:Static converters:ShadowConverter.Instance}}" |
| 31 | + CornerRadius="{TemplateBinding UniformCornerRadius}"> |
| 32 | + <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" |
| 33 | + x:Name="PART_ClipBorder" |
| 34 | + Clip="{TemplateBinding ContentClip}" /> |
| 35 | + </Border> |
| 36 | + </AdornerDecorator> |
| 37 | + <ContentPresenter x:Name="ContentPresenter" |
| 38 | + Margin="{TemplateBinding Padding}" |
| 39 | + Content="{TemplateBinding ContentControl.Content}" |
| 40 | + ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" |
| 41 | + ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" |
| 42 | + ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" /> |
| 43 | + </Grid> |
| 44 | + <ControlTemplate.Triggers> |
| 45 | + <Trigger Property="ClipContent" Value="True"> |
| 46 | + <Setter Property="Clip" TargetName="ContentPresenter" Value="{Binding ContentClip, RelativeSource={RelativeSource TemplatedParent}}" /> |
| 47 | + </Trigger> |
| 48 | + </ControlTemplate.Triggers> |
| 49 | + </ControlTemplate> |
| 50 | + </Setter.Value> |
| 51 | + </Setter> |
51 | 52 | </Style>
|
52 | 53 |
|
| 54 | + <Style x:Key="MaterialDesignOutlinedCard" TargetType="{x:Type wpf:Card}"> |
| 55 | + <Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}" /> |
| 56 | + <Setter Property="Focusable" Value="False"/> |
| 57 | + <Setter Property="Template"> |
| 58 | + <Setter.Value> |
| 59 | + <ControlTemplate TargetType="{x:Type wpf:Card}"> |
| 60 | + <Grid Background="Transparent"> |
| 61 | + <Border BorderThickness="1" CornerRadius="{TemplateBinding UniformCornerRadius, Converter={x:Static converters:DoubleToCornerRadiusConverter.Instance}}" BorderBrush="{DynamicResource MaterialDesignDivider}"> |
| 62 | + <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" |
| 63 | + x:Name="PART_ClipBorder" |
| 64 | + Clip="{TemplateBinding ContentClip}"> |
| 65 | + <ContentPresenter x:Name="ContentPresenter" |
| 66 | + Margin="{TemplateBinding Padding}" |
| 67 | + Content="{TemplateBinding ContentControl.Content}" |
| 68 | + ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" |
| 69 | + ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" |
| 70 | + ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" /> |
| 71 | + </Border> |
| 72 | + </Border> |
| 73 | + </Grid> |
| 74 | + <ControlTemplate.Triggers> |
| 75 | + <Trigger Property="ClipContent" Value="True"> |
| 76 | + <Setter Property="Clip" TargetName="ContentPresenter" Value="{Binding ContentClip, RelativeSource={RelativeSource TemplatedParent}}" /> |
| 77 | + </Trigger> |
| 78 | + </ControlTemplate.Triggers> |
| 79 | + </ControlTemplate> |
| 80 | + </Setter.Value> |
| 81 | + </Setter> |
| 82 | + </Style> |
| 83 | + |
53 | 84 | </ResourceDictionary>
|
0 commit comments