整理代码
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:internal="clr-namespace:Melskin.Converters.Internal"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="RepeatButtonTransparent.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- 滑块默认样式 -->
|
||||
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="ShadowSliderThumbTemplate">
|
||||
<ControlTemplate x:Key="ShadowSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
||||
<Grid
|
||||
HorizontalAlignment="Center"
|
||||
UseLayoutRounding="True"
|
||||
VerticalAlignment="Center">
|
||||
VerticalAlignment="Center"
|
||||
UseLayoutRounding="True">
|
||||
<Ellipse
|
||||
Fill="{DynamicResource ControlBackgroundNormalBrush}"
|
||||
Height="20"
|
||||
StrokeThickness="1"
|
||||
x:Name="grip"
|
||||
Width="20"
|
||||
x:Name="grip">
|
||||
Height="20"
|
||||
Fill="{DynamicResource ControlBackgroundNormalBrush}"
|
||||
StrokeThickness="1">
|
||||
<Ellipse.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="12"
|
||||
Color="{DynamicResource DarkShadowColor}"
|
||||
Opacity="0.4" />
|
||||
Opacity="0.4"
|
||||
Color="{DynamicResource DarkShadowColor}" />
|
||||
</Ellipse.Effect>
|
||||
</Ellipse>
|
||||
|
||||
@@ -30,34 +30,34 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True" />
|
||||
<Trigger Property="IsDragging" Value="True">
|
||||
<Setter Property="Effect" TargetName="grip">
|
||||
<Setter TargetName="grip" Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect
|
||||
BlurRadius="4"
|
||||
Color="{DynamicResource DarkShadowColor}"
|
||||
Opacity="0.6"
|
||||
ShadowDepth="3" />
|
||||
ShadowDepth="3"
|
||||
Color="{DynamicResource DarkShadowColor}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Effect" TargetName="grip" Value="{x:Null}" />
|
||||
<Setter Property="Fill" TargetName="grip" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="Stroke" TargetName="grip" Value="{DynamicResource PrimaryDisabledBrush}" />
|
||||
<Setter TargetName="grip" Property="Effect" Value="{x:Null}" />
|
||||
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource PrimaryDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate TargetType="{x:Type Slider}" x:Key="ShadowSliderVerticalTemplate">
|
||||
<ControlTemplate x:Key="ShadowSliderVerticalTemplate" TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -65,29 +65,29 @@
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
x:Name="TopTick"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,2,0"
|
||||
Placement="Left"
|
||||
Visibility="Collapsed"
|
||||
Width="4"
|
||||
x:Name="TopTick" />
|
||||
Margin="0,0,2,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Left"
|
||||
Visibility="Collapsed" />
|
||||
<Border
|
||||
x:Name="TrackBackground"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="8"
|
||||
HorizontalAlignment="center"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="center"
|
||||
Width="8"
|
||||
x:Name="TrackBackground">
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4"
|
||||
Width="8"
|
||||
Margin="-1"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="8">
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4">
|
||||
<Border.Height>
|
||||
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="1">
|
||||
<Binding
|
||||
@@ -111,17 +111,17 @@
|
||||
</Border>
|
||||
<Canvas Margin="-1,-6">
|
||||
<Rectangle
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden"
|
||||
x:Name="PART_SelectionRange"
|
||||
Width="4.0"
|
||||
x:Name="PART_SelectionRange" />
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Track
|
||||
Grid.Column="1"
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="0"
|
||||
x:Name="PART_Track">
|
||||
Grid.Column="1">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
@@ -130,34 +130,34 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
Focusable="False"
|
||||
Height="20"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ShadowSliderThumbTemplate}"
|
||||
VerticalAlignment="Top"
|
||||
x:Name="Thumb"
|
||||
Width="22"
|
||||
x:Name="Thumb" />
|
||||
Height="20"
|
||||
VerticalAlignment="Top"
|
||||
Focusable="False"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ShadowSliderThumbTemplate}" />
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="2"
|
||||
x:Name="BottomTick"
|
||||
Grid.Row="0"
|
||||
Margin="2,0,0,0"
|
||||
Placement="Right"
|
||||
Visibility="Collapsed"
|
||||
Grid.Column="2"
|
||||
Width="4"
|
||||
x:Name="BottomTick" />
|
||||
Margin="2,0,0,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Right"
|
||||
Visibility="Collapsed" />
|
||||
<!-- 新增:简单的值显示TextBlock -->
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Grid.Column="1"
|
||||
x:Name="ValueDisplay"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Grid.Column="1"
|
||||
Margin="0,4,0,0"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ValueDisplay">
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}">
|
||||
<TextBlock.LayoutTransform>
|
||||
<RotateTransform Angle="-90" />
|
||||
</TextBlock.LayoutTransform>
|
||||
@@ -166,36 +166,36 @@
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TickPlacement" Value="TopLeft">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="2,5,0,5" />
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="2,5,0,5" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="BottomRight">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="0,5,2,5" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="0,5,2,5" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="Both">
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelectionRangeEnabled" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible" />
|
||||
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="Foreground" TargetName="Thumb" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
<!-- 新增:可以选择是否显示值 -->
|
||||
<Trigger Property="Tag" Value="HideValue">
|
||||
<Setter Property="Visibility" TargetName="ValueDisplay" Value="Collapsed" />
|
||||
<Setter TargetName="ValueDisplay" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate TargetType="{x:Type Slider}" x:Key="ShadowSliderHorizontalTemplate">
|
||||
<ControlTemplate x:Key="ShadowSliderHorizontalTemplate" TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -207,29 +207,29 @@
|
||||
<ColumnDefinition Width="40" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
x:Name="TopTick"
|
||||
Grid.Row="0"
|
||||
Height="4"
|
||||
Margin="0,0,0,2"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Top"
|
||||
Visibility="Collapsed"
|
||||
x:Name="TopTick" />
|
||||
Visibility="Collapsed" />
|
||||
<Border
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Grid.Column="0"
|
||||
x:Name="TrackBackground"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Height="8"
|
||||
VerticalAlignment="center"
|
||||
x:Name="TrackBackground">
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4"
|
||||
Height="8"
|
||||
Margin="-1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-1">
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4">
|
||||
<Border.Width>
|
||||
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="0">
|
||||
<Binding
|
||||
@@ -253,18 +253,18 @@
|
||||
</Border>
|
||||
<Canvas Margin="-6,-1">
|
||||
<Rectangle
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
x:Name="PART_SelectionRange"
|
||||
Height="4.0"
|
||||
Visibility="Hidden"
|
||||
x:Name="PART_SelectionRange" />
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
<Track
|
||||
Grid.Column="0"
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="1"
|
||||
x:Name="PART_Track">
|
||||
Grid.Column="0">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
@@ -273,58 +273,58 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
Focusable="False"
|
||||
Height="22"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ShadowSliderThumbTemplate}"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="Thumb"
|
||||
Width="20"
|
||||
x:Name="Thumb" />
|
||||
Height="22"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ShadowSliderThumbTemplate}" />
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="0"
|
||||
x:Name="BottomTick"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Height="4"
|
||||
Margin="0,2,0,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Bottom"
|
||||
Visibility="Collapsed"
|
||||
x:Name="BottomTick" />
|
||||
Visibility="Collapsed" />
|
||||
<!-- 新增:简单的值显示TextBlock,放在滑块下方 -->
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Grid.Column="1"
|
||||
x:Name="ValueDisplay"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Grid.Column="1"
|
||||
Margin="4,0,0,0"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ValueDisplay" />
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TickPlacement" Value="TopLeft">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="5,2,5,0" />
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="5,2,5,0" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="BottomRight">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="5,0,5,2" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="5,0,5,2" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="Both">
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelectionRangeEnabled" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible" />
|
||||
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="Foreground" TargetName="Thumb" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<Style TargetType="{x:Type Slider}" x:Key="ShadowSliderStyle">
|
||||
<Style x:Key="ShadowSliderStyle" TargetType="{x:Type Slider}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
@@ -364,17 +364,17 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="DefaultSliderThumbTemplate">
|
||||
<ControlTemplate x:Key="DefaultSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
||||
<Grid
|
||||
HorizontalAlignment="Center"
|
||||
UseLayoutRounding="True"
|
||||
VerticalAlignment="Center">
|
||||
VerticalAlignment="Center"
|
||||
UseLayoutRounding="True">
|
||||
<Ellipse
|
||||
Fill="{DynamicResource ControlBackgroundNormalBrush}"
|
||||
Height="15"
|
||||
StrokeThickness="1"
|
||||
x:Name="grip"
|
||||
Width="15"
|
||||
x:Name="grip">
|
||||
Height="15"
|
||||
Fill="{DynamicResource ControlBackgroundNormalBrush}"
|
||||
StrokeThickness="1">
|
||||
<!--<Ellipse.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="12"
|
||||
@@ -398,25 +398,25 @@
|
||||
</Setter>-->
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Effect" TargetName="grip" Value="{x:Null}" />
|
||||
<Setter Property="Fill" TargetName="grip" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="Stroke" TargetName="grip" Value="{DynamicResource PrimaryDisabledBrush}" />
|
||||
<Setter TargetName="grip" Property="Effect" Value="{x:Null}" />
|
||||
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource PrimaryDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- 轨道垂直默认样式 -->
|
||||
<ControlTemplate TargetType="{x:Type Slider}" x:Key="SliderVerticalTemplate">
|
||||
<ControlTemplate x:Key="SliderVerticalTemplate" TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -424,29 +424,29 @@
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
x:Name="TopTick"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,2,0"
|
||||
Placement="Left"
|
||||
Visibility="Collapsed"
|
||||
Width="4"
|
||||
x:Name="TopTick" />
|
||||
Margin="0,0,2,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Left"
|
||||
Visibility="Collapsed" />
|
||||
<Border
|
||||
x:Name="TrackBackground"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="8"
|
||||
HorizontalAlignment="center"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="center"
|
||||
Width="8"
|
||||
x:Name="TrackBackground">
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4"
|
||||
Width="8"
|
||||
Margin="-1"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="8">
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4">
|
||||
<Border.Height>
|
||||
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="1">
|
||||
<Binding
|
||||
@@ -470,17 +470,17 @@
|
||||
</Border>
|
||||
<Canvas Margin="-1,-6">
|
||||
<Rectangle
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden"
|
||||
x:Name="PART_SelectionRange"
|
||||
Width="4.0"
|
||||
x:Name="PART_SelectionRange" />
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Track
|
||||
Grid.Column="1"
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="0"
|
||||
x:Name="PART_Track">
|
||||
Grid.Column="1">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
@@ -489,32 +489,32 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
x:Name="Thumb"
|
||||
VerticalAlignment="Top"
|
||||
Focusable="False"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource DefaultSliderThumbTemplate}"
|
||||
VerticalAlignment="Top"
|
||||
x:Name="Thumb" />
|
||||
Template="{StaticResource DefaultSliderThumbTemplate}" />
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="2"
|
||||
x:Name="BottomTick"
|
||||
Grid.Row="0"
|
||||
Margin="2,0,0,0"
|
||||
Placement="Right"
|
||||
Visibility="Collapsed"
|
||||
Grid.Column="2"
|
||||
Width="4"
|
||||
x:Name="BottomTick" />
|
||||
Margin="2,0,0,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Right"
|
||||
Visibility="Collapsed" />
|
||||
<!-- 新增:简单的值显示TextBlock -->
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Grid.Column="1"
|
||||
x:Name="ValueDisplay"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Grid.Column="1"
|
||||
Margin="0,4,0,0"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ValueDisplay">
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}">
|
||||
<TextBlock.LayoutTransform>
|
||||
<RotateTransform Angle="-90" />
|
||||
</TextBlock.LayoutTransform>
|
||||
@@ -523,37 +523,37 @@
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TickPlacement" Value="TopLeft">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="2,5,0,5" />
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="2,5,0,5" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="BottomRight">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="0,5,2,5" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="0,5,2,5" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="Both">
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelectionRangeEnabled" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible" />
|
||||
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="Foreground" TargetName="Thumb" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
<!-- 新增:可以选择是否显示值 -->
|
||||
<Trigger Property="Tag" Value="HideValue">
|
||||
<Setter Property="Visibility" TargetName="ValueDisplay" Value="Collapsed" />
|
||||
<Setter TargetName="ValueDisplay" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- 轨道水平默认样式 -->
|
||||
<ControlTemplate TargetType="{x:Type Slider}" x:Key="SliderHorizontalTemplate">
|
||||
<ControlTemplate x:Key="SliderHorizontalTemplate" TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -565,29 +565,29 @@
|
||||
<ColumnDefinition Width="40" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
x:Name="TopTick"
|
||||
Grid.Row="0"
|
||||
Height="4"
|
||||
Margin="0,0,0,2"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Top"
|
||||
Visibility="Collapsed"
|
||||
x:Name="TopTick" />
|
||||
Visibility="Collapsed" />
|
||||
<Border
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Grid.Column="0"
|
||||
x:Name="TrackBackground"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Height="8"
|
||||
VerticalAlignment="center"
|
||||
x:Name="TrackBackground">
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4"
|
||||
Height="8"
|
||||
Margin="-1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-1">
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="4">
|
||||
<Border.Width>
|
||||
<MultiBinding Converter="{x:Static internal:ValueToRangeWidthConverter.Instance}" ConverterParameter="0">
|
||||
<Binding
|
||||
@@ -611,18 +611,18 @@
|
||||
</Border>
|
||||
<Canvas Margin="-6,-1">
|
||||
<Rectangle
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
x:Name="PART_SelectionRange"
|
||||
Height="4.0"
|
||||
Visibility="Hidden"
|
||||
x:Name="PART_SelectionRange" />
|
||||
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
|
||||
Visibility="Hidden" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
<Track
|
||||
Grid.Column="0"
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="1"
|
||||
x:Name="PART_Track">
|
||||
Grid.Column="0">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
@@ -631,54 +631,54 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
Focusable="False"
|
||||
Height="22"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource DefaultSliderThumbTemplate}"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="Thumb"
|
||||
Width="20"
|
||||
x:Name="Thumb" />
|
||||
Height="22"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource DefaultSliderThumbTemplate}" />
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
<TickBar
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="0"
|
||||
x:Name="BottomTick"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Height="4"
|
||||
Margin="0,2,0,0"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Placement="Bottom"
|
||||
Visibility="Collapsed"
|
||||
x:Name="BottomTick" />
|
||||
Visibility="Collapsed" />
|
||||
<!-- 新增:简单的值显示TextBlock,放在滑块下方 -->
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Grid.Column="1"
|
||||
x:Name="ValueDisplay"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Grid.Column="1"
|
||||
Margin="4,0,0,0"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ValueDisplay" />
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="TickPlacement" Value="TopLeft">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="5,2,5,0" />
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="5,2,5,0" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="BottomRight">
|
||||
<Setter Property="Margin" TargetName="TrackBackground" Value="5,0,5,2" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TrackBackground" Property="Margin" Value="5,0,5,2" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="TickPlacement" Value="Both">
|
||||
<Setter Property="Visibility" TargetName="TopTick" Value="Visible" />
|
||||
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible" />
|
||||
<Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelectionRangeEnabled" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible" />
|
||||
<Setter TargetName="PART_SelectionRange" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="Foreground" TargetName="Thumb" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="Thumb" Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user