Files
Shrlalgo.RvKits/Melskin/Controls/Slider.xaml

725 lines
35 KiB
Plaintext
Raw Normal View History

2025-07-31 20:12:01 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2026-02-20 15:31:44 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
2025-07-31 20:12:24 +08:00
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="RepeatButtonTransparent.xaml" />
</ResourceDictionary.MergedDictionaries>
2025-07-11 09:20:23 +08:00
2025-07-31 20:12:01 +08:00
<!-- 滑块默认样式 -->
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="ShadowSliderThumbTemplate" TargetType="{x:Type Thumb}">
2025-07-31 20:12:01 +08:00
<Grid
HorizontalAlignment="Center"
2026-02-20 15:31:44 +08:00
VerticalAlignment="Center"
UseLayoutRounding="True">
2025-07-31 20:12:01 +08:00
<Ellipse
2026-02-20 15:31:44 +08:00
x:Name="grip"
2026-01-02 17:30:30 +08:00
Width="20"
2026-02-20 15:31:44 +08:00
Height="20"
Fill="{DynamicResource ControlBackgroundNormalBrush}"
StrokeThickness="1">
2025-07-11 09:20:23 +08:00
<Ellipse.Effect>
2025-07-31 20:12:01 +08:00
<DropShadowEffect
BlurRadius="12"
2026-02-20 15:31:44 +08:00
Opacity="0.4"
Color="{DynamicResource DarkShadowColor}" />
2025-07-11 09:20:23 +08:00
</Ellipse.Effect>
</Ellipse>
</Grid>
<ControlTemplate.Triggers>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsMouseOver" Value="True" />
<Trigger Property="IsDragging" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="grip" Property="Effect">
2025-07-11 09:20:23 +08:00
<Setter.Value>
2025-07-31 20:12:01 +08:00
<DropShadowEffect
BlurRadius="4"
Opacity="0.6"
2026-02-20 15:31:44 +08:00
ShadowDepth="3"
Color="{DynamicResource DarkShadowColor}" />
2025-07-11 09:20:23 +08:00
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
2026-02-20 15:31:44 +08:00
<Setter TargetName="grip" Property="Effect" Value="{x:Null}" />
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource PrimaryDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="ShadowSliderVerticalTemplate" TargetType="{x:Type Slider}">
2025-12-28 11:47:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="border"
2025-12-28 11:47:54 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-12-28 11:47:54 +08:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
2026-02-20 15:31:44 +08:00
<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}" />
2025-12-28 11:47:54 +08:00
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="TopTick"
2025-12-28 11:47:54 +08:00
Grid.Column="0"
2026-02-20 15:31:44 +08:00
Width="4"
2025-12-28 11:47:54 +08:00
Margin="0,0,2,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
2025-12-28 11:47:54 +08:00
Placement="Left"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-12-28 11:47:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="TrackBackground"
2026-01-02 17:30:30 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Width="8"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="center"
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="4">
2025-12-28 11:47:54 +08:00
<Grid>
<Border
2026-02-20 15:31:44 +08:00
Width="8"
2025-12-28 11:47:54 +08:00
Margin="-1"
VerticalAlignment="Bottom"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Foreground}"
CornerRadius="4">
2025-12-28 11:47:54 +08:00
<Border.Height>
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="1">
<Binding
Mode="OneWay"
Path="Minimum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Maximum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Value"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="ActualHeight"
RelativeSource="{RelativeSource AncestorType={x:Type Border}}" />
</MultiBinding>
</Border.Height>
</Border>
<Canvas Margin="-1,-6">
<Rectangle
2026-02-20 15:31:44 +08:00
x:Name="PART_SelectionRange"
2026-01-02 17:30:30 +08:00
Width="4.0"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
Visibility="Hidden" />
2025-12-28 11:47:54 +08:00
</Canvas>
</Grid>
</Border>
<Track
2026-02-20 15:31:44 +08:00
x:Name="PART_Track"
2025-12-28 11:47:54 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="1">
2025-12-28 11:47:54 +08:00
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb
2026-02-20 15:31:44 +08:00
x:Name="Thumb"
Width="22"
2026-01-02 17:30:30 +08:00
Height="20"
VerticalAlignment="Top"
2026-02-20 15:31:44 +08:00
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource ShadowSliderThumbTemplate}" />
2025-12-28 11:47:54 +08:00
</Track.Thumb>
</Track>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="BottomTick"
2026-01-02 17:30:30 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="2"
Width="4"
2025-12-28 11:47:54 +08:00
Margin="2,0,0,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
2025-12-28 11:47:54 +08:00
Placement="Right"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-12-28 11:47:54 +08:00
<!-- 新增简单的值显示TextBlock -->
<TextBlock
2026-02-20 15:31:44 +08:00
x:Name="ValueDisplay"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Margin="0,4,0,0"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="Center"
2025-12-28 11:47:54 +08:00
VerticalAlignment="Center"
2026-02-20 15:31:44 +08:00
Foreground="{DynamicResource PrimaryNormalBrush}"
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}">
2025-12-28 11:47:54 +08:00
<TextBlock.LayoutTransform>
<RotateTransform Angle="-90" />
</TextBlock.LayoutTransform>
</TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="2,5,0,5" />
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="0,5,2,5" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="IsSelectionRangeEnabled" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-12-28 11:47:54 +08:00
</Trigger>
<!-- 新增:可以选择是否显示值 -->
<Trigger Property="Tag" Value="HideValue">
2026-02-20 15:31:44 +08:00
<Setter TargetName="ValueDisplay" Property="Visibility" Value="Collapsed" />
2025-12-28 11:47:54 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="ShadowSliderHorizontalTemplate" TargetType="{x:Type Slider}">
2025-12-28 11:47:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="border"
2025-12-28 11:47:54 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-12-28 11:47:54 +08:00
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="TopTick"
2025-12-28 11:47:54 +08:00
Grid.Row="0"
Height="4"
Margin="0,0,0,2"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
2025-12-28 11:47:54 +08:00
Placement="Top"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-12-28 11:47:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="TrackBackground"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="0"
2025-12-28 11:47:54 +08:00
Height="8"
VerticalAlignment="center"
2026-02-20 15:31:44 +08:00
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="4">
2025-12-28 11:47:54 +08:00
<Grid>
<Border
Height="8"
2026-02-20 15:31:44 +08:00
Margin="-1"
2025-12-28 11:47:54 +08:00
HorizontalAlignment="Left"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Foreground}"
CornerRadius="4">
2025-12-28 11:47:54 +08:00
<Border.Width>
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="0">
<Binding
Mode="OneWay"
Path="Minimum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Maximum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Value"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="ActualWidth"
RelativeSource="{RelativeSource AncestorType={x:Type Border}}" />
</MultiBinding>
</Border.Width>
</Border>
<Canvas Margin="-6,-1">
<Rectangle
2026-02-20 15:31:44 +08:00
x:Name="PART_SelectionRange"
2026-01-02 17:30:30 +08:00
Height="4.0"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
Visibility="Hidden" />
2025-12-28 11:47:54 +08:00
</Canvas>
</Grid>
</Border>
<Track
2026-02-20 15:31:44 +08:00
x:Name="PART_Track"
2025-12-28 11:47:54 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="0">
2025-12-28 11:47:54 +08:00
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb
2026-02-20 15:31:44 +08:00
x:Name="Thumb"
Width="20"
2026-01-02 17:30:30 +08:00
Height="22"
VerticalAlignment="Center"
2026-02-20 15:31:44 +08:00
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource ShadowSliderThumbTemplate}" />
2025-12-28 11:47:54 +08:00
</Track.Thumb>
</Track>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="BottomTick"
2026-01-02 17:30:30 +08:00
Grid.Row="2"
2026-02-20 15:31:44 +08:00
Grid.Column="0"
2025-12-28 11:47:54 +08:00
Height="4"
Margin="0,2,0,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
2025-12-28 11:47:54 +08:00
Placement="Bottom"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-12-28 11:47:54 +08:00
<!-- 新增简单的值显示TextBlock放在滑块下方 -->
<TextBlock
2026-02-20 15:31:44 +08:00
x:Name="ValueDisplay"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Margin="4,0,0,0"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="Center"
2025-12-28 11:47:54 +08:00
VerticalAlignment="Center"
2026-02-20 15:31:44 +08:00
Foreground="{DynamicResource PrimaryNormalBrush}"
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}" />
2025-12-28 11:47:54 +08:00
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="5,2,5,0" />
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="5,0,5,2" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="IsSelectionRangeEnabled" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-12-28 11:47:54 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2026-02-20 15:31:44 +08:00
<Style x:Key="ShadowSliderStyle" TargetType="{x:Type Slider}">
2025-12-28 11:47:54 +08:00
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryGradientBrush}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
<Setter Property="Template" Value="{StaticResource ShadowSliderHorizontalTemplate}" />
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource ShadowSliderVerticalTemplate}" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
</Trigger>
<!-- 触发器当IsEnabled属性为False时设置前景色为灰色 -->
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="TopLeft" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="BottomRight" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="Both" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
</Style.Triggers>
</Style>
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="DefaultSliderThumbTemplate" TargetType="{x:Type Thumb}">
2025-12-28 11:47:54 +08:00
<Grid
HorizontalAlignment="Center"
2026-02-20 15:31:44 +08:00
VerticalAlignment="Center"
UseLayoutRounding="True">
2025-12-28 11:47:54 +08:00
<Ellipse
2026-02-20 15:31:44 +08:00
x:Name="grip"
2026-01-02 17:30:30 +08:00
Width="15"
2026-02-20 15:31:44 +08:00
Height="15"
Fill="{DynamicResource ControlBackgroundNormalBrush}"
StrokeThickness="1">
2026-02-22 20:03:42 +08:00
<Ellipse.Effect>
2025-12-28 11:47:54 +08:00
<DropShadowEffect
BlurRadius="12"
Opacity="0.4"
Color="{DynamicResource DarkShadowColor}" />
2026-02-22 20:03:42 +08:00
</Ellipse.Effect>
2025-12-28 11:47:54 +08:00
</Ellipse>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True" />
<Trigger Property="IsDragging" Value="True">
2026-02-22 20:03:42 +08:00
<Setter TargetName="grip" Property="Effect">
2025-12-28 11:47:54 +08:00
<Setter.Value>
<DropShadowEffect
BlurRadius="4"
Opacity="0.6"
ShadowDepth="3"
Color="{DynamicResource DarkShadowColor}" />
</Setter.Value>
2026-02-22 20:03:42 +08:00
</Setter>
2025-12-28 11:47:54 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="False">
2026-02-20 15:31:44 +08:00
<Setter TargetName="grip" Property="Effect" Value="{x:Null}" />
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource PrimaryDisabledBrush}" />
2025-12-28 11:47:54 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2025-07-11 09:20:23 +08:00
2025-07-31 20:12:01 +08:00
<!-- 轨道垂直默认样式 -->
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="SliderVerticalTemplate" TargetType="{x:Type Slider}">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="border"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-07-11 09:20:23 +08:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
2026-02-20 15:31:44 +08:00
<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}" />
2025-07-11 09:20:23 +08:00
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
2025-07-31 20:12:01 +08:00
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="TopTick"
2025-07-31 20:12:01 +08:00
Grid.Column="0"
2026-02-20 15:31:44 +08:00
Width="4"
Margin="0,0,2,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
Placement="Left"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="TrackBackground"
2026-01-02 17:30:30 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Width="8"
2026-02-22 20:03:42 +08:00
Margin="0,5,0,5"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="center"
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="4">
2025-07-11 09:20:23 +08:00
<Grid>
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
Width="8"
2025-07-31 20:12:01 +08:00
Margin="-1"
VerticalAlignment="Bottom"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Foreground}"
CornerRadius="4">
2025-07-11 09:20:23 +08:00
<Border.Height>
2025-08-20 12:10:13 +08:00
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="1">
2025-07-31 20:12:01 +08:00
<Binding
Mode="OneWay"
Path="Minimum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Maximum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Value"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="ActualHeight"
RelativeSource="{RelativeSource AncestorType={x:Type Border}}" />
2025-07-11 09:20:23 +08:00
</MultiBinding>
</Border.Height>
</Border>
<Canvas Margin="-1,-6">
2025-07-31 20:12:01 +08:00
<Rectangle
2026-02-20 15:31:44 +08:00
x:Name="PART_SelectionRange"
2026-01-02 17:30:30 +08:00
Width="4.0"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
Visibility="Hidden" />
2025-07-11 09:20:23 +08:00
</Canvas>
</Grid>
</Border>
2025-10-10 11:19:58 +08:00
<Track
2026-02-20 15:31:44 +08:00
x:Name="PART_Track"
2025-10-10 11:19:58 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="1">
2025-07-11 09:20:23 +08:00
<Track.DecreaseRepeatButton>
2025-10-10 11:19:58 +08:00
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
2025-07-11 09:20:23 +08:00
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
2025-10-10 11:19:58 +08:00
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
2025-07-11 09:20:23 +08:00
</Track.IncreaseRepeatButton>
<Track.Thumb>
2025-07-31 20:12:01 +08:00
<Thumb
2026-02-20 15:31:44 +08:00
x:Name="Thumb"
VerticalAlignment="Top"
2025-12-23 21:35:54 +08:00
Focusable="False"
OverridesDefaultStyle="True"
2026-02-20 15:31:44 +08:00
Template="{StaticResource DefaultSliderThumbTemplate}" />
2025-07-11 09:20:23 +08:00
</Track.Thumb>
</Track>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="BottomTick"
2026-01-02 17:30:30 +08:00
Grid.Row="0"
2026-02-20 15:31:44 +08:00
Grid.Column="2"
Width="4"
Margin="2,0,0,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
Placement="Right"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
<!-- 新增简单的值显示TextBlock -->
<TextBlock
2026-02-20 15:31:44 +08:00
x:Name="ValueDisplay"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
2026-02-22 20:03:42 +08:00
Foreground="{TemplateBinding Foreground}"
2026-02-20 15:31:44 +08:00
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}">
<TextBlock.LayoutTransform>
<RotateTransform Angle="-90" />
</TextBlock.LayoutTransform>
</TextBlock>
2025-07-11 09:20:23 +08:00
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="2,5,0,5" />
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="0,5,2,5" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsSelectionRangeEnabled" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsKeyboardFocused" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<!-- 新增:可以选择是否显示值 -->
<Trigger Property="Tag" Value="HideValue">
2026-02-20 15:31:44 +08:00
<Setter TargetName="ValueDisplay" Property="Visibility" Value="Collapsed" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2025-07-31 20:12:01 +08:00
<!-- 轨道水平默认样式 -->
2026-02-20 15:31:44 +08:00
<ControlTemplate x:Key="SliderHorizontalTemplate" TargetType="{x:Type Slider}">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="border"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-07-11 09:20:23 +08:00
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
2025-07-31 20:12:01 +08:00
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="TopTick"
2025-07-31 20:12:01 +08:00
Grid.Row="0"
Height="4"
Margin="0,0,0,2"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
Placement="Top"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="TrackBackground"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="0"
2025-07-31 20:12:01 +08:00
Height="8"
2026-02-22 20:03:42 +08:00
Margin="5,0,5,0"
2025-07-31 20:12:01 +08:00
VerticalAlignment="center"
2026-02-20 15:31:44 +08:00
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="4">
2025-07-11 09:20:23 +08:00
<Grid>
2025-07-31 20:12:01 +08:00
<Border
Height="8"
2026-02-20 15:31:44 +08:00
Margin="-1"
2025-07-31 20:12:01 +08:00
HorizontalAlignment="Left"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Foreground}"
CornerRadius="4">
2025-07-11 09:20:23 +08:00
<Border.Width>
2025-08-20 12:10:13 +08:00
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="0">
2025-07-31 20:12:01 +08:00
<Binding
Mode="OneWay"
Path="Minimum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Maximum"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="Value"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding
Mode="OneWay"
Path="ActualWidth"
RelativeSource="{RelativeSource AncestorType={x:Type Border}}" />
2025-07-11 09:20:23 +08:00
</MultiBinding>
</Border.Width>
</Border>
<Canvas Margin="-6,-1">
2025-07-31 20:12:01 +08:00
<Rectangle
2026-02-20 15:31:44 +08:00
x:Name="PART_SelectionRange"
2026-01-02 17:30:30 +08:00
Height="4.0"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
Visibility="Hidden" />
2025-07-11 09:20:23 +08:00
</Canvas>
</Grid>
</Border>
2025-10-10 11:19:58 +08:00
<Track
2026-02-20 15:31:44 +08:00
x:Name="PART_Track"
2025-10-10 11:19:58 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="0">
2025-07-11 09:20:23 +08:00
<Track.DecreaseRepeatButton>
2025-10-10 11:19:58 +08:00
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
2025-07-11 09:20:23 +08:00
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
2025-10-10 11:19:58 +08:00
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
2025-07-11 09:20:23 +08:00
</Track.IncreaseRepeatButton>
<Track.Thumb>
2025-07-31 20:12:01 +08:00
<Thumb
2026-02-20 15:31:44 +08:00
x:Name="Thumb"
Width="20"
2026-01-02 17:30:30 +08:00
Height="22"
VerticalAlignment="Center"
2026-02-20 15:31:44 +08:00
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource DefaultSliderThumbTemplate}" />
2025-07-11 09:20:23 +08:00
</Track.Thumb>
</Track>
<TickBar
2026-02-20 15:31:44 +08:00
x:Name="BottomTick"
2026-01-02 17:30:30 +08:00
Grid.Row="2"
2026-02-20 15:31:44 +08:00
Grid.Column="0"
Height="4"
Margin="0,2,0,0"
2026-02-20 15:31:44 +08:00
Fill="{TemplateBinding Foreground}"
Placement="Bottom"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
<TextBlock
2026-02-20 15:31:44 +08:00
x:Name="ValueDisplay"
2026-01-02 17:30:30 +08:00
Grid.Row="1"
2026-02-20 15:31:44 +08:00
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
2026-02-22 20:03:42 +08:00
Foreground="{TemplateBinding Foreground}"
2026-02-20 15:31:44 +08:00
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}" />
2025-07-11 09:20:23 +08:00
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="5,2,5,0" />
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TrackBackground" Property="Margin" Value="5,0,5,2" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
2026-02-20 15:31:44 +08:00
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsSelectionRangeEnabled" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsKeyboardFocused" Value="True">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="{x:Type Slider}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource PrimaryGradientBrush}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
2025-10-10 11:19:58 +08:00
<Setter Property="Template" Value="{StaticResource SliderHorizontalTemplate}" />
2025-07-11 09:20:23 +08:00
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
2025-10-10 11:19:58 +08:00
<Setter Property="Template" Value="{StaticResource SliderVerticalTemplate}" />
2025-08-12 23:08:54 +08:00
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
2025-07-11 09:20:23 +08:00
</Trigger>
<!-- 触发器当IsEnabled属性为False时设置前景色为灰色 -->
<Trigger Property="IsEnabled" Value="False">
2025-08-20 12:10:13 +08:00
<Setter Property="Foreground" Value="{DynamicResource PrimaryDisabledBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="TopLeft" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="BottomRight" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="TickPlacement" Value="Both" />
</MultiTrigger.Conditions>
<Setter Property="IsSnapToTickEnabled" Value="True" />
</MultiTrigger>
2025-07-11 09:20:23 +08:00
</Style.Triggers>
</Style>
</ResourceDictionary>