清理ColorPicker,进度条。修复UI问题

This commit is contained in:
2026-02-23 16:49:34 +08:00
parent 1d939d52ed
commit 18174b404c
29 changed files with 1028 additions and 576 deletions

View File

@@ -23,6 +23,7 @@
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="ContentHost"
Grid.Column="0"
Margin="4,0,0,0"
HorizontalAlignment="Left"
@@ -64,12 +65,15 @@
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -108,6 +112,7 @@
</controls:IconElement.RenderTransform>
</controls:IconElement>
<ContentPresenter
x:Name="ContentHost"
Grid.Column="0"
Margin="4,0,0,0"
HorizontalAlignment="Left"
@@ -135,12 +140,15 @@
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -179,6 +187,7 @@
</controls:IconElement>
<ContentPresenter
x:Name="ContentHost"
Grid.Row="1"
Margin="0,4,0,0"
HorizontalAlignment="Center"
@@ -210,12 +219,15 @@
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -254,6 +266,7 @@
</controls:IconElement>
<ContentPresenter
x:Name="ContentHost"
Grid.Row="1"
Margin="0,4,0,0"
HorizontalAlignment="Center"
@@ -285,12 +298,15 @@
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryHoverBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="ContentHost" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -298,7 +314,7 @@
</Setter>
</Style>
<Style TargetType="{x:Type Expander}">
<Style x:Key="FlashExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -383,4 +399,251 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Margin" Value="4" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<ControlTemplate.Resources>
<!-- 缓动函数 -->
<CubicEase x:Key="EaseInOut" EasingMode="EaseInOut" />
<!-- 上下展开动画 (控制 ScaleY) -->
<Storyboard x:Key="ExpandDownUp">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"
From="0"
To="1"
Duration="0:0:0.25" />
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.25" />
</Storyboard>
<!-- 上下折叠动画 -->
<Storyboard x:Key="CollapseDownUp">
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)"
From="1"
To="0"
Duration="0:0:0.25" />
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="Opacity"
From="1"
To="0"
Duration="0:0:0.25" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
<DiscreteObjectKeyFrame KeyTime="0:0:0.25" Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<!-- 左右展开动画 (控制 ScaleX) -->
<Storyboard x:Key="ExpandLeftRight">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"
From="0"
To="1"
Duration="0:0:0.25" />
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:0.25" />
</Storyboard>
<!-- 左右折叠动画 -->
<Storyboard x:Key="CollapseLeftRight">
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"
From="1"
To="0"
Duration="0:0:0.25" />
<DoubleAnimation
EasingFunction="{StaticResource EaseInOut}"
Storyboard.TargetName="ExpandSite"
Storyboard.TargetProperty="Opacity"
From="1"
To="0"
Duration="0:0:0.25" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
<DiscreteObjectKeyFrame KeyTime="0:0:0.25" Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="True">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
Padding="6"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FocusVisualStyle="{DynamicResource FocusVisual}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpanderDownHeaderStyle}" />
<!-- 展开内容区,初始默认为隐藏、透明,且携带 Transform 基底 -->
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Bottom"
Focusable="False"
Opacity="0"
Visibility="Collapsed">
<ContentPresenter.LayoutTransform>
<!-- 不再写 x:Name="ExpandScale",提供默认的比例 1,1 供动画去修改 -->
<ScaleTransform ScaleX="1" ScaleY="1" />
</ContentPresenter.LayoutTransform>
</ContentPresenter>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<!-- 1. 基础布局及方向设置 (仅调整布局结构,不再去控制 Scale) -->
<Trigger Property="ExpandDirection" Value="Right">
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Stretch" />
</Trigger>
<Trigger Property="ExpandDirection" Value="Up">
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Trigger>
<Trigger Property="ExpandDirection" Value="Left">
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Stretch" />
</Trigger>
<!-- 2. 为四个方向绑定动画,依靠 Storyboard 中的 From="0" To="1" 实现丝滑展开 -->
<!-- Down -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ExpandDirection" Value="Down" />
<Condition Property="IsExpanded" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ExpandSite" Property="Opacity" Value="1" />
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ExpandDownUp}" />
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource CollapseDownUp}" />
</MultiTrigger.ExitActions>
</MultiTrigger>
<!-- Up -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ExpandDirection" Value="Up" />
<Condition Property="IsExpanded" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ExpandSite" Property="Opacity" Value="1" />
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ExpandDownUp}" />
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource CollapseDownUp}" />
</MultiTrigger.ExitActions>
</MultiTrigger>
<!-- Left -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ExpandDirection" Value="Left" />
<Condition Property="IsExpanded" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ExpandSite" Property="Opacity" Value="1" />
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ExpandLeftRight}" />
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource CollapseLeftRight}" />
</MultiTrigger.ExitActions>
</MultiTrigger>
<!-- Right -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ExpandDirection" Value="Right" />
<Condition Property="IsExpanded" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ExpandSite" Property="Opacity" Value="1" />
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ExpandLeftRight}" />
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource CollapseLeftRight}" />
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>