Files
ShrlAlgoToolkit/ShrlAlgo.Toolkit.Wpf/Themes/Controls.xaml

1389 lines
69 KiB
Plaintext
Raw Normal View History

2025-07-11 09:20:23 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:conv="clr-namespace:ShrlAlgoToolkit.Mvvm.Converters;assembly=ShrlAlgoToolkit.Mvvm"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Colors.xaml" />
</ResourceDictionary.MergedDictionaries>
<conv:BooleanToVisConverter x:Key="BooleanToVisConverter" />
<!-- Base Style -->
<Style x:Key="GlassBase">
<Setter Property="Control.Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="Control.BorderBrush" Value="{StaticResource GlassBorderBrush}" />
<Setter Property="Control.BorderThickness" Value="1.5" />
<Setter Property="Control.Foreground" Value="{StaticResource PrimaryTextBrush}" />
</Style>
<!-- Button Style (圆角减小为6) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="Button"
x:Key="GlassButton">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="16,8" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border
Background="Transparent"
CornerRadius="6"
Margin="1,3,1,0"
x:Name="shadow">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Color="#80B0C4DE"
Opacity="0.15"
ShadowDepth="2" />
</Border.Effect>
</Border>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
x:Name="border">
<Grid>
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="6"
Opacity="0.18" />
<ContentPresenter
HorizontalAlignment="Center"
Margin="2,1,2,1"
VerticalAlignment="Center"
x:Name="contentPresenter" />
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#B0E0FF" />
<Setter Property="Opacity" TargetName="border" Value="0.95" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" TargetName="border" Value="0.85" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TextBox Style -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="TextBox"
x:Key="GlassTextBox">
<Setter Property="Padding" Value="10,6" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid>
<Border
Background="Transparent"
CornerRadius="8"
Margin="1,3,1,0"
x:Name="shadow">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Color="#80B0C4DE"
Opacity="0.13"
ShadowDepth="1" />
</Border.Effect>
</Border>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="border">
<Grid>
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="8"
Opacity="0.18" />
<ScrollViewer Margin="{TemplateBinding Padding}" x:Name="PART_ContentHost" />
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#B0E0FF" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- PasswordBox Style -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="PasswordBox"
x:Key="GlassPasswordBox">
<Setter Property="Padding" Value="10,6" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Grid>
<Border
Background="Transparent"
CornerRadius="8"
Margin="1,3,1,0"
x:Name="shadow">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Color="#80B0C4DE"
Opacity="0.13"
ShadowDepth="1" />
</Border.Effect>
</Border>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="border">
<Grid>
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="8"
Opacity="0.18" />
<ScrollViewer Margin="{TemplateBinding Padding}" x:Name="PART_ContentHost" />
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#B0E0FF" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ComboBox Style (优化Popup宽度) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="ComboBox"
x:Key="GlassComboBox">
<Setter Property="MinWidth" Value="80" />
<Setter Property="Padding" Value="10,6" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<Border
Background="Transparent"
CornerRadius="8"
Margin="1,3,1,0"
x:Name="shadow">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Color="#80B0C4DE"
Opacity="0.13"
ShadowDepth="1" />
</Border.Effect>
</Border>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="border">
<Grid>
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="8"
Opacity="0.18" />
<Grid>
<ContentPresenter
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
x:Name="contentPresenter" />
<ToggleButton
Background="Transparent"
BorderThickness="0"
Focusable="False"
Grid.Column="1"
Height="24"
HorizontalAlignment="Right"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Margin="0,0,4,0"
VerticalAlignment="Center"
Width="24"
x:Name="toggleButton">
<Path
Data="M0,0 L8,0 L4,5 Z"
Fill="#B0E0FF"
Height="8"
Stretch="Uniform"
Width="12"
x:Name="arrow" />
</ToggleButton>
</Grid>
</Grid>
</Border>
<Popup
AllowsTransparency="True"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
PopupAnimation="Fade"
x:Name="PART_Popup">
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="#B0E0FF"
BorderThickness="1.5"
CornerRadius="8"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}"
x:Name="dropDownBorder">
<ScrollViewer SnapsToDevicePixels="True">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ListBox Style -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="ListBox"
x:Key="GlassListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Grid>
<Border
Background="Transparent"
CornerRadius="8"
Margin="1,3,1,0"
x:Name="shadow">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Color="#80B0C4DE"
Opacity="0.13"
ShadowDepth="1" />
</Border.Effect>
</Border>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="border">
<Grid>
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="8"
Opacity="0.18" />
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</Grid>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TreeView Toggle Button Style -->
<Style TargetType="ToggleButton" x:Key="TreeViewToggleButtonStyle">
<Setter Property="Width" Value="16" />
<Setter Property="Height" Value="16" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border
Background="Transparent"
Height="16"
Width="16">
<Path
Data="M 4 6 L 8 10 L 12 6"
Height="8"
RenderTransformOrigin="0.5,0.5"
Stretch="Uniform"
Stroke="#B0E0FF"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="1.5"
Width="8"
x:Name="ExpandPath">
<Path.RenderTransform>
<RotateTransform Angle="0" x:Name="ExpandPathRotate" />
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="ExpandPathRotate"
Storyboard.TargetProperty="Angle"
To="180" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="ExpandPathRotate"
Storyboard.TargetProperty="Angle"
To="0" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Stroke" TargetName="ExpandPath" Value="#D0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TreeView Style -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="TreeView"
x:Key="GlassTreeView">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeView">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6">
<ScrollViewer
CanContentScroll="False"
Focusable="False"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
Padding="{TemplateBinding Padding}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TreeViewItem Style -->
<Style TargetType="TreeViewItem" x:Key="GlassTreeViewItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="4,2" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ToggleButton
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Margin="1,0,4,0"
Style="{StaticResource TreeViewToggleButtonStyle}"
VerticalAlignment="Center"
x:Name="Expander" />
<Border
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="1"
CornerRadius="4"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True"
x:Name="Bd">
<ContentPresenter
ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="PART_Header" />
</Border>
<ItemsPresenter
Grid.Column="1"
Grid.Row="1"
Margin="12,0,0,0"
x:Name="ItemsHost" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="False">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden" />
</Trigger>
<Trigger Property="IsExpanded" Value="False">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#33B0E0FF" />
<Setter Property="BorderBrush" TargetName="Bd" Value="#B0E0FF" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#22FFFFFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- RadioButton Style -->
<Style TargetType="RadioButton" x:Key="GlassRadioButton">
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Padding" Value="8,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="{StaticResource GlassBorderBrush}"
BorderThickness="1.5"
CornerRadius="9"
Height="18"
Width="18"
x:Name="radioOuter">
<Border
Background="#B0E0FF"
CornerRadius="4"
Height="8"
Opacity="0"
Width="8"
x:Name="radioInner" />
</Border>
<ContentPresenter
Grid.Column="1"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Opacity" TargetName="radioInner" Value="1" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="radioOuter" Value="#B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- CheckBox Style -->
<Style TargetType="CheckBox" x:Key="GlassCheckBox">
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Padding" Value="8,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="{StaticResource GlassBorderBrush}"
BorderThickness="1.5"
CornerRadius="4"
Height="18"
Width="18"
x:Name="checkOuter">
<Path
Data="M1,5 L4,9 L9,1"
Height="10"
Opacity="0"
Stretch="Uniform"
Stroke="#B0E0FF"
StrokeThickness="2"
Width="10"
x:Name="checkMark" />
</Border>
<ContentPresenter
Grid.Column="1"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Opacity" TargetName="checkMark" Value="1" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="checkOuter" Value="#B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Slider Style -->
<Style TargetType="Slider" x:Key="GlassSlider">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
Background="#40FFFFFF"
BorderBrush="{StaticResource GlassBorderBrush}"
BorderThickness="1"
CornerRadius="2"
Grid.Row="1"
Height="4"
Margin="5,0"
x:Name="TrackBackground" />
<Track Grid.Row="1" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton
Background="{StaticResource GlassGradientBrush}"
BorderBrush="Transparent"
Command="Slider.DecreaseLarge"
Opacity="0" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton
Background="Transparent"
BorderBrush="Transparent"
Command="Slider.IncreaseLarge"
Opacity="0" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb">
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Grid>
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="{StaticResource GlassBorderBrush}"
BorderThickness="1.5"
CornerRadius="8"
Height="16"
Width="16">
<Border
Background="{StaticResource GlassHighlightBrush}"
CornerRadius="8"
Opacity="0.25" />
</Border>
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ProgressBar Style (不确定进度条动画修正) -->
<Style TargetType="ProgressBar" x:Key="GlassProgressBar">
<Setter Property="Height" Value="8" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<Grid>
<Border
Background="#40FFFFFF"
BorderBrush="{StaticResource GlassBorderBrush}"
BorderThickness="1"
CornerRadius="4" />
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="Transparent"
CornerRadius="4"
x:Name="PART_Track">
<Border.Effect>
<DropShadowEffect
BlurRadius="8"
Color="#80B0E0FF"
ShadowDepth="0" />
</Border.Effect>
</Border>
<Rectangle
Fill="#B0E0FF"
Height="8"
HorizontalAlignment="Left"
RadiusX="4"
RadiusY="4"
Visibility="Visible"
x:Name="PART_Indicator" />
<Rectangle
Fill="#80B0E0FF"
Height="8"
HorizontalAlignment="Left"
RadiusX="4"
RadiusY="4"
Visibility="Collapsed"
Width="60"
x:Name="PART_Glow">
<Rectangle.RenderTransform>
<TranslateTransform X="0" x:Name="GlowTransform" />
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="True">
<Setter Property="Visibility" TargetName="PART_Indicator" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PART_Glow" Value="Visible" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Duration="0:0:1.2"
From="0"
Storyboard.TargetName="GlowTransform"
Storyboard.TargetProperty="X"
To="200" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<RemoveStoryboard />
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ScrollBar Style -->
<Style TargetType="ScrollBar" x:Key="GlassScrollBar">
<Setter Property="Width" Value="8" />
<Setter Property="MinWidth" Value="8" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid
Background="Transparent"
SnapsToDevicePixels="true"
x:Name="Bg">
<Track IsDirectionReversed="true" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Opacity="0" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Opacity="0" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Border
Background="{StaticResource GlassGradientBrushHorizontal}"
BorderBrush="#40FFFFFF"
BorderThickness="1"
CornerRadius="4"
Opacity="0.6"
x:Name="ThumbBorder">
<Border.Effect>
<DropShadowEffect
BlurRadius="4"
Color="#40B0E0FF"
ShadowDepth="0" />
</Border.Effect>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" TargetName="ThumbBorder" Value="0.8" />
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter Property="Opacity" TargetName="ThumbBorder" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Height" Value="8" />
<Setter Property="MinHeight" Value="8" />
</Trigger>
</Style.Triggers>
</Style>
<!-- ScrollViewer Style -->
<Style TargetType="ScrollViewer" x:Key="GlassScrollViewer">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Grid Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollContentPresenter Grid.Column="0" Grid.Row="0" />
<ScrollBar
Grid.Column="1"
Grid.Row="0"
Maximum="{TemplateBinding ScrollableHeight}"
Style="{StaticResource GlassScrollBar}"
Value="{TemplateBinding VerticalOffset}"
ViewportSize="{TemplateBinding ViewportHeight}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
x:Name="PART_VerticalScrollBar" />
<ScrollBar
Grid.Column="0"
Grid.Row="1"
Maximum="{TemplateBinding ScrollableWidth}"
Orientation="Horizontal"
Style="{StaticResource GlassScrollBar}"
Value="{TemplateBinding HorizontalOffset}"
ViewportSize="{TemplateBinding ViewportWidth}"
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
x:Name="PART_HorizontalScrollBar" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DataGrid Style (表头显示、编辑样式) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="DataGrid"
x:Key="GlassDataGrid">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="GridLinesVisibility" Value="All" />
<Setter Property="RowHeight" Value="32" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalGridLinesBrush" Value="#15B0E0FF" />
<Setter Property="VerticalGridLinesBrush" Value="#15B0E0FF" />
<Setter Property="RowBackground" Value="#10FFFFFF" />
<Setter Property="AlternatingRowBackground" Value="#05B0E0FF" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="SelectionUnit" Value="FullRow" />
<Setter Property="CanUserAddRows" Value="False" />
<Setter Property="CanUserDeleteRows" Value="False" />
<Setter Property="CanUserResizeRows" Value="False" />
<Setter Property="AutoGenerateColumns" Value="True" />
<Setter Property="CellStyle">
<Setter.Value>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="8,4" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<Border
Background="{TemplateBinding Background}"
BorderThickness="0"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True"
x:Name="Bd">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#33B0E0FF" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#22FFFFFF" />
</Trigger>
<Trigger Property="IsEditing" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#FFF9F9F9" />
<Setter Property="BorderBrush" TargetName="Bd" Value="#B0E0FF" />
<Setter Property="BorderThickness" TargetName="Bd" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ColumnHeaderStyle">
<Setter.Value>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#22B0E0FF" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Height" Value="40" />
<Setter Property="Padding" Value="8,0" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="#B0E0FF" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
x:Name="BackgroundBorder">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGrid">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
SnapsToDevicePixels="True">
<ScrollViewer
Focusable="false"
Style="{StaticResource GlassScrollViewer}"
x:Name="DG_ScrollViewer">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Expander 箭头按钮样式(垂直居中) -->
<Style TargetType="ToggleButton" x:Key="ExpanderToggleButtonStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border
Background="Transparent"
Height="24"
SnapsToDevicePixels="True"
VerticalAlignment="Center"
Width="24">
<Path
Data="M 0,0 L 10,0 L 5,7 Z"
Fill="#B0E0FF"
Height="14"
HorizontalAlignment="Center"
RenderTransformOrigin="0.5,0.5"
SnapsToDevicePixels="True"
VerticalAlignment="Center"
Width="14"
x:Name="Arrow">
<Path.RenderTransform>
<RotateTransform Angle="0" x:Name="ArrowRotate" />
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="ArrowRotate"
Storyboard.TargetProperty="Angle"
To="180" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="ArrowRotate"
Storyboard.TargetProperty="Angle"
To="0" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Fill" TargetName="Arrow" Value="#D0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Expander Style (箭头放右侧) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="Expander"
x:Key="GlassExpander">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="8" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6">
<DockPanel>
<Grid
Background="Transparent"
DockPanel.Dock="Top"
Height="32">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
ContentSource="Header"
Grid.Column="0"
Margin="4,0,0,0"
RecognizesAccessKey="True"
VerticalAlignment="Center" />
<ToggleButton
Grid.Column="1"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Margin="4,0,4,0"
Style="{StaticResource ExpanderToggleButtonStyle}"
VerticalAlignment="Center"
x:Name="HeaderToggle" />
</Grid>
<Border
Background="#10FFFFFF"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="0,1,0,0"
CornerRadius="0,0,5,5"
DockPanel.Dock="Bottom"
Margin="1,4,1,1"
Padding="12,8"
Visibility="Collapsed"
x:Name="ContentBorder">
<ContentPresenter />
</Border>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Visibility" TargetName="ContentBorder" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- GroupBox Style 全面重写支持Header -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="GroupBox"
x:Key="GlassGroupBox">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="12" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6" />
<TextBlock
FontWeight="Bold"
Foreground="{StaticResource PrimaryTextBrush}"
Margin="16,0,0,0"
Text="{TemplateBinding Header}"
VerticalAlignment="Top" />
<ContentPresenter Margin="12,28,12,12" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Calendar Navigation Button Style (前后翻页、年/月切换) -->
<Style TargetType="Button" x:Key="GlassCalendarNavButton">
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" />
<Setter Property="Background" Value="#10B0E0FF" />
<Setter Property="BorderBrush" Value="#B0E0FF" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="16"
x:Name="Bd">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#22B0E0FF" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#33B0E0FF" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="Bd" Value="0.4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Calendar RepeatButton Style (用于长按翻页) -->
<Style TargetType="RepeatButton" x:Key="GlassCalendarRepeatButton">
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" />
<Setter Property="Background" Value="#10B0E0FF" />
<Setter Property="BorderBrush" Value="#B0E0FF" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="16"
x:Name="Bd">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#22B0E0FF" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="Bd" Value="#33B0E0FF" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="Bd" Value="0.4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Calendar Button Style (年/月/周标题按钮) -->
<Style TargetType="CalendarButton" x:Key="GlassCalendarButton">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarButton">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="ButtonBackground">
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Name="ButtonContent" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="ButtonBackground" Value="#22B0E0FF" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" TargetName="ButtonBackground" Value="#33B0E0FF" />
<Setter Property="BorderBrush" TargetName="ButtonBackground" Value="#B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Calendar Day Button Style (日期按钮) -->
<Style TargetType="CalendarDayButton" x:Key="GlassCalendarDayButton">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDayButton">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8"
x:Name="ButtonBackground">
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Name="ButtonContent" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="ButtonBackground" Value="#22B0E0FF" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="ButtonBackground" Value="#33B0E0FF" />
<Setter Property="BorderBrush" TargetName="ButtonBackground" Value="#B0E0FF" />
</Trigger>
<Trigger Property="IsToday" Value="True">
<Setter Property="BorderBrush" TargetName="ButtonBackground" Value="#B0E0FF" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="ButtonBackground" Value="0.4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Calendar Style (应用所有按钮样式) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="Calendar"
x:Key="GlassCalendar">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Calendar">
<CalendarItem
Background="Transparent"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
x:Name="PART_CalendarItem">
<CalendarItem.Resources>
<Style BasedOn="{StaticResource GlassCalendarNavButton}" TargetType="Button" />
<Style BasedOn="{StaticResource GlassCalendarRepeatButton}" TargetType="RepeatButton" />
<Style BasedOn="{StaticResource GlassCalendarButton}" TargetType="CalendarButton" />
<Style BasedOn="{StaticResource GlassCalendarDayButton}" TargetType="CalendarDayButton" />
</CalendarItem.Resources>
</CalendarItem>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DatePickerTextBox 美化 -->
<Style TargetType="DatePickerTextBox" x:Key="GlassDatePickerTextBox">
<Setter Property="Background" Value="#10FFFFFF" />
<Setter Property="BorderBrush" Value="#B0E0FF" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="8,4" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePickerTextBox">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
x:Name="Bd">
<ScrollViewer
Background="Transparent"
Margin="0"
x:Name="PART_ContentHost" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="BorderBrush" TargetName="Bd" Value="#33B0E0FF" />
<Setter Property="Background" TargetName="Bd" Value="#22B0E0FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DatePicker Style (应用美化TextBox, 不使用TextBoxStyle属性) -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="DatePicker"
x:Key="GlassDatePicker">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CalendarStyle" Value="{StaticResource GlassCalendar}" />
<Setter Property="Foreground" Value="{StaticResource PrimaryTextBrush}" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePicker">
<Border
Background="{TemplateBinding Background}"
BorderBrush="#B0E0FF"
BorderThickness="2"
CornerRadius="8"
x:Name="PART_Root">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<DatePickerTextBox
Background="Transparent"
BorderThickness="0"
Focusable="{TemplateBinding Focusable}"
Foreground="{TemplateBinding Foreground}"
Grid.Column="0"
HorizontalContentAlignment="Left"
Margin="8,0,0,0"
Style="{StaticResource GlassDatePickerTextBox}"
VerticalContentAlignment="Center"
x:Name="PART_TextBox" />
<Button
Grid.Column="1"
Height="32"
Margin="0,0,2,0"
Padding="0"
Style="{StaticResource GlassButton}"
VerticalAlignment="Center"
Width="32"
x:Name="PART_Button">
<Path
Data="M2,4 H18 V16 H2 V4 M5,0 V8 M15,0 V8 M2,8 H18"
Height="16"
Stretch="Uniform"
Stroke="#B0E0FF"
StrokeThickness="1.5"
Width="16" />
</Button>
<Popup
AllowsTransparency="True"
IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
StaysOpen="False"
x:Name="PART_Popup">
<Border
Background="{StaticResource GlassGradientBrush}"
BorderBrush="#B0E0FF"
BorderThickness="2"
CornerRadius="8"
Margin="0,4,0,0">
<Calendar
Background="Transparent"
BorderThickness="0"
SelectedDate="{Binding SelectedDate, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource GlassCalendar}"
x:Name="PART_Calendar" />
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TabControl/TabItem Style 全面重写修复内容显示和Header对齐 -->
<Style
BasedOn="{StaticResource GlassBase}"
TargetType="TabControl"
x:Key="GlassTabControl">
<Setter Property="Background" Value="{StaticResource GlassGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabControl">
<Grid>
<TabPanel
Background="Transparent"
IsItemsHost="True"
Margin="4,4,4,0"
Panel.ZIndex="1"
x:Name="HeaderPanel" />
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="6"
Margin="0,32,0,0"
x:Name="ContentPanel">
<ContentPresenter Margin="8" x:Name="PART_SelectedContentHost" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>