Files
Shrlalgo.RvKits/WPFluent/Controls/CardAction/CardAction.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

124 lines
8.0 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:WPFluent.Controls"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="CardActionPadding">14,16,14,16</Thickness>
<Thickness x:Key="CardActionBorderThemeThickness">1</Thickness>
<Thickness x:Key="CardActionIconMargin">0,0,14,0</Thickness>
<Thickness x:Key="CardActionChevronMargin">4,0,0,0</Thickness>
<system:Double x:Key="CardActionIconSize">24.0</system:Double>
<system:Double x:Key="CardActionChevronSize">16.0</system:Double>
<Style TargetType="{x:Type controls:CardAction}" x:Key="DefaultUiCardActionStyle">
<!-- Universal WPF UI focus -->
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
<!-- Universal WPF UI focus -->
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource CardActionBorderThemeThickness}" />
<Setter Property="Padding" Value="{StaticResource CardActionPadding}" />
<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="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:CardAction}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding Border.CornerRadius}"
Height="{TemplateBinding Height}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
MinHeight="{TemplateBinding MinHeight}"
MinWidth="{TemplateBinding MinWidth}"
Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Width="{TemplateBinding Width}"
x:Name="ContentBorder">
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentControl
Content="{TemplateBinding Icon}"
Focusable="False"
FontSize="{StaticResource CardActionIconSize}"
Foreground="{TemplateBinding Foreground}"
Grid.Column="0"
KeyboardNavigation.IsTabStop="False"
Margin="{StaticResource CardActionIconMargin}"
VerticalAlignment="Center"
x:Name="ControlIcon" />
<ContentPresenter
Content="{TemplateBinding Content}"
Grid.Column="1"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="Center"
x:Name="ContentPresenter" />
<controls:SymbolIcon
FontSize="{StaticResource CardActionChevronSize}"
Grid.Column="2"
Margin="{StaticResource CardActionChevronMargin}"
Symbol="ChevronRight24"
VerticalAlignment="Center"
x:Name="ChevronIcon" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Trigger>
<Trigger Property="IsChevronVisible" Value="False">
<Setter Property="Visibility" TargetName="ChevronIcon" Value="Collapsed" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
<Setter Property="TextElement.Foreground" TargetName="ContentPresenter" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="Foreground" TargetName="ControlIcon" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="Foreground" TargetName="ChevronIcon" Value="{DynamicResource TextFillColorDisabledBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource ControlFillColorTertiaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
<Setter Property="TextElement.Foreground" TargetName="ContentPresenter" Value="{DynamicResource TextFillColorSecondaryBrush}" />
<Setter Property="Foreground" TargetName="ControlIcon" Value="{DynamicResource TextFillColorSecondaryBrush}" />
<Setter Property="Foreground" TargetName="ChevronIcon" Value="{DynamicResource TextFillColorSecondaryBrush}" />
</Trigger>
<Trigger Property="Content" Value="{x:Null}">
<Setter Property="Margin" TargetName="ControlIcon" Value="0" />
</Trigger>
<Trigger Property="Content" Value="">
<Setter Property="Margin" TargetName="ControlIcon" Value="0" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Margin" TargetName="ControlIcon" Value="0" />
<Setter Property="Visibility" TargetName="ControlIcon" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource DefaultUiCardActionStyle}" TargetType="{x:Type controls:CardAction}" />
</ResourceDictionary>