Files
ShrlAlgoToolkit/WPFluent/Controls/Card/Card.xaml

77 lines
4.2 KiB
Plaintext
Raw Normal View History

2025-07-11 09:20:23 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2025-07-11 09:20:23 +08:00
xmlns:controls="clr-namespace:WPFluent.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="CardPadding">14,16,14,16</Thickness>
<Thickness x:Key="CardBorderThemeThickness">1</Thickness>
<Style TargetType="{x:Type controls:Card}">
2025-07-11 09:20:23 +08:00
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource CardBorderThemeThickness}" />
<Setter Property="Padding" Value="{StaticResource CardPadding}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Card}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2025-07-11 09:20:23 +08:00
CornerRadius="{TemplateBinding Border.CornerRadius}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
x:Name="ContentBorder">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2025-07-11 09:20:23 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="ContentPresenter" />
</Border>
<Border
2025-07-11 09:20:23 +08:00
Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="0,0,4,4"
2025-07-11 09:20:23 +08:00
Grid.Row="1"
Padding="{TemplateBinding Padding}"
Visibility="Collapsed"
x:Name="FooterBorder">
<ContentPresenter Content="{TemplateBinding Footer}" x:Name="FooterContentPresenter" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasFooter" Value="True">
2025-07-11 09:20:23 +08:00
<Setter Property="Visibility" TargetName="FooterBorder" Value="Visible" />
<Setter Property="CornerRadius" TargetName="ContentBorder" Value="4,4,0,0" />
<Setter Property="BorderThickness" TargetName="ContentBorder" Value="1,1,1,0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>