2025-07-11 09:20:23 +08:00
|
|
|
<ResourceDictionary
|
2025-02-10 20:53:40 +08:00
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:controls="clr-namespace:WPFluent.Controls"
|
|
|
|
|
xmlns:converters="clr-namespace:WPFluent.Converters"
|
2025-07-11 09:20:23 +08:00
|
|
|
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-02-10 20:53:40 +08:00
|
|
|
|
|
|
|
|
<Thickness x:Key="CardExpanderPadding">14,16,14,16</Thickness>
|
|
|
|
|
<Thickness x:Key="CardExpanderBorderThemeThickness">1</Thickness>
|
|
|
|
|
<Thickness x:Key="CardExpanderIconMargin">0,0,14,0</Thickness>
|
|
|
|
|
<Thickness x:Key="CardExpanderContentMargin">14,0,0,0</Thickness>
|
|
|
|
|
<Thickness x:Key="CardExpanderChevronMargin">4,0,0,0</Thickness>
|
|
|
|
|
<system:Double x:Key="CardExpanderIconSize">24.0</system:Double>
|
|
|
|
|
<system:Double x:Key="CardExpanderChevronSize">16.0</system:Double>
|
|
|
|
|
|
2025-07-11 09:20:23 +08:00
|
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}" x:Key="DefaultUiCardExpanderToggleButtonStyle">
|
|
|
|
|
<Grid Background="Transparent" Margin="{TemplateBinding Padding}">
|
2025-02-10 20:53:40 +08:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<ContentPresenter
|
2025-07-11 09:20:23 +08:00
|
|
|
Content="{TemplateBinding Content}"
|
2025-02-10 20:53:40 +08:00
|
|
|
Grid.Column="0"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-07-11 09:20:23 +08:00
|
|
|
x:Name="ContentPresenter" />
|
2025-02-10 20:53:40 +08:00
|
|
|
<Grid
|
2025-07-11 09:20:23 +08:00
|
|
|
Background="Transparent"
|
2025-02-10 20:53:40 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
Margin="0"
|
2025-07-11 09:20:23 +08:00
|
|
|
RenderTransformOrigin="0.5, 0.5"
|
2025-02-10 20:53:40 +08:00
|
|
|
VerticalAlignment="Center"
|
2025-07-11 09:20:23 +08:00
|
|
|
x:Name="ChevronGrid">
|
2025-02-10 20:53:40 +08:00
|
|
|
<Grid.RenderTransform>
|
|
|
|
|
<RotateTransform Angle="0" />
|
|
|
|
|
</Grid.RenderTransform>
|
|
|
|
|
<controls:SymbolIcon
|
|
|
|
|
FontSize="{StaticResource CardExpanderChevronSize}"
|
|
|
|
|
Foreground="{TemplateBinding Foreground}"
|
2025-07-11 09:20:23 +08:00
|
|
|
Symbol="ChevronDown24"
|
|
|
|
|
x:Name="ControlChevronIcon" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
|
|
|
|
<Trigger.EnterActions>
|
|
|
|
|
<BeginStoryboard>
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<DoubleAnimation
|
2025-07-11 09:20:23 +08:00
|
|
|
Duration="00:00:00.167"
|
2025-02-10 20:53:40 +08:00
|
|
|
Storyboard.TargetName="ChevronGrid"
|
|
|
|
|
Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)"
|
2025-07-11 09:20:23 +08:00
|
|
|
To="180" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Storyboard>
|
|
|
|
|
</BeginStoryboard>
|
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
<Trigger.ExitActions>
|
|
|
|
|
<BeginStoryboard>
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<DoubleAnimation
|
2025-07-11 09:20:23 +08:00
|
|
|
Duration="00:00:00.167"
|
2025-02-10 20:53:40 +08:00
|
|
|
Storyboard.TargetName="ChevronGrid"
|
|
|
|
|
Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)"
|
2025-07-11 09:20:23 +08:00
|
|
|
To="0" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Storyboard>
|
|
|
|
|
</BeginStoryboard>
|
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
2025-07-11 09:20:23 +08:00
|
|
|
<Style TargetType="{x:Type controls:CardExpander}" x:Key="DefaultUiCardExpanderStyle">
|
2025-02-10 20:53:40 +08:00
|
|
|
<!-- Universal WPF UI focus -->
|
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
|
|
|
<!-- Universal WPF UI focus -->
|
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}" />
|
2025-02-10 20:53:40 +08:00
|
|
|
<Setter Property="BorderThickness" Value="{StaticResource CardExpanderBorderThemeThickness}" />
|
|
|
|
|
<Setter Property="Padding" Value="{StaticResource CardExpanderPadding}" />
|
|
|
|
|
<Setter Property="ContentPadding" Value="{StaticResource CardExpanderPadding}" />
|
|
|
|
|
<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="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
|
|
|
<Setter Property="IsExpanded" Value="False" />
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:CardExpander}">
|
|
|
|
|
<ControlTemplate.Resources>
|
|
|
|
|
<converters:AnimationFactorToValueConverter x:Key="AnimationFactorToValueConverter" />
|
|
|
|
|
</ControlTemplate.Resources>
|
|
|
|
|
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
|
|
<!-- Top level controls always visible -->
|
|
|
|
|
<Border
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="1"
|
2025-07-11 09:20:23 +08:00
|
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
|
|
|
Grid.Row="0"
|
|
|
|
|
x:Name="ToggleButtonBorder">
|
2025-02-10 20:53:40 +08:00
|
|
|
<ToggleButton
|
|
|
|
|
FontSize="{TemplateBinding FontSize}"
|
|
|
|
|
Foreground="{TemplateBinding Foreground}"
|
2025-07-11 09:20:23 +08:00
|
|
|
HorizontalAlignment="Stretch"
|
|
|
|
|
HorizontalContentAlignment="Stretch"
|
2025-02-10 20:53:40 +08:00
|
|
|
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
IsEnabled="{TemplateBinding IsEnabled}"
|
2025-07-11 09:20:23 +08:00
|
|
|
Margin="0"
|
2025-02-10 20:53:40 +08:00
|
|
|
OverridesDefaultStyle="True"
|
2025-07-11 09:20:23 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
|
Template="{StaticResource DefaultUiCardExpanderToggleButtonStyle}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
VerticalContentAlignment="Center"
|
|
|
|
|
x:Name="ExpanderToggleButton">
|
2025-02-10 20:53:40 +08:00
|
|
|
<ToggleButton.Content>
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
<ContentControl
|
|
|
|
|
Content="{TemplateBinding Icon}"
|
|
|
|
|
Focusable="False"
|
|
|
|
|
FontSize="{StaticResource CardExpanderIconSize}"
|
|
|
|
|
Foreground="{TemplateBinding Foreground}"
|
2025-07-11 09:20:23 +08:00
|
|
|
Grid.Column="0"
|
|
|
|
|
KeyboardNavigation.IsTabStop="False"
|
|
|
|
|
Margin="{StaticResource CardExpanderIconMargin}"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
x:Name="ControlIcon" />
|
2025-02-10 20:53:40 +08:00
|
|
|
|
|
|
|
|
<ContentPresenter
|
|
|
|
|
Content="{TemplateBinding Header}"
|
2025-07-11 09:20:23 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
|
TextElement.Foreground="{TemplateBinding Foreground}"
|
|
|
|
|
x:Name="HeaderContentPresenter" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Grid>
|
|
|
|
|
</ToggleButton.Content>
|
|
|
|
|
</ToggleButton>
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
<!-- Collapsed content to expand -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<Grid ClipToBounds="True" Grid.Row="1">
|
2025-02-10 20:53:40 +08:00
|
|
|
<Border
|
2025-07-11 09:20:23 +08:00
|
|
|
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
2025-02-10 20:53:40 +08:00
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="1,0,1,1"
|
|
|
|
|
CornerRadius="0,0,4,4"
|
2025-07-11 09:20:23 +08:00
|
|
|
Visibility="Collapsed"
|
|
|
|
|
x:Name="ContentPresenterBorder">
|
2025-02-10 20:53:40 +08:00
|
|
|
<ContentPresenter
|
2025-07-11 09:20:23 +08:00
|
|
|
Content="{TemplateBinding Content}"
|
2025-02-10 20:53:40 +08:00
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-07-11 09:20:23 +08:00
|
|
|
Margin="{TemplateBinding ContentPadding}"
|
2025-02-10 20:53:40 +08:00
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2025-07-11 09:20:23 +08:00
|
|
|
x:Name="ContentPresenter" />
|
2025-02-10 20:53:40 +08:00
|
|
|
<Border.Tag>
|
|
|
|
|
<system:Double>0.0</system:Double>
|
|
|
|
|
</Border.Tag>
|
|
|
|
|
<Border.RenderTransform>
|
|
|
|
|
<TranslateTransform>
|
|
|
|
|
<TranslateTransform.Y>
|
|
|
|
|
<MultiBinding Converter="{StaticResource AnimationFactorToValueConverter}" ConverterParameter="negative">
|
|
|
|
|
<Binding ElementName="ContentPresenterBorder" Path="ActualHeight" />
|
|
|
|
|
<Binding ElementName="ContentPresenterBorder" Path="Tag" />
|
|
|
|
|
</MultiBinding>
|
|
|
|
|
</TranslateTransform.Y>
|
|
|
|
|
</TranslateTransform>
|
|
|
|
|
</Border.RenderTransform>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsExpanded" Value="True">
|
|
|
|
|
<!-- TODO: Update -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="CornerRadius" TargetName="ToggleButtonBorder" Value="4,4,0,0" />
|
2025-02-10 20:53:40 +08:00
|
|
|
<Trigger.EnterActions>
|
|
|
|
|
<BeginStoryboard>
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterBorder" Storyboard.TargetProperty="(Border.Visibility)">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterBorder" Storyboard.TargetProperty="Tag">
|
|
|
|
|
<DiscreteDoubleKeyFrame KeyTime="0" Value="1.0" />
|
|
|
|
|
<SplineDoubleKeyFrame
|
|
|
|
|
KeySpline="0.0, 0.0, 0.0, 1.0"
|
|
|
|
|
KeyTime="0:0:0.333"
|
|
|
|
|
Value="0.0" />
|
|
|
|
|
</DoubleAnimationUsingKeyFrames>
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</BeginStoryboard>
|
|
|
|
|
</Trigger.EnterActions>
|
|
|
|
|
<Trigger.ExitActions>
|
|
|
|
|
<BeginStoryboard>
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterBorder" Storyboard.TargetProperty="(Border.Visibility)">
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
|
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="{x:Static Visibility.Collapsed}" />
|
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenterBorder" Storyboard.TargetProperty="Tag">
|
|
|
|
|
<DiscreteDoubleKeyFrame KeyTime="0" Value="0.0" />
|
|
|
|
|
<SplineDoubleKeyFrame
|
|
|
|
|
KeySpline="1.0, 1.0, 0.0, 1.0"
|
|
|
|
|
KeyTime="0:0:0.167"
|
|
|
|
|
Value="1.0" />
|
|
|
|
|
</DoubleAnimationUsingKeyFrames>
|
|
|
|
|
</Storyboard>
|
|
|
|
|
</BeginStoryboard>
|
|
|
|
|
</Trigger.ExitActions>
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2025-07-11 09:20:23 +08:00
|
|
|
<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="ExpanderToggleButton" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="Icon" Value="{x:Null}">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Margin" TargetName="ControlIcon" Value="0" />
|
|
|
|
|
<Setter Property="Visibility" TargetName="ControlIcon" Value="Collapsed" />
|
2025-02-10 20:53:40 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<Style BasedOn="{StaticResource DefaultUiCardExpanderStyle}" TargetType="{x:Type controls:CardExpander}" />
|
|
|
|
|
|
|
|
|
|
</ResourceDictionary>
|