Files
Shrlalgo.RvKits/WPFDark/StandardControls/Slider.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

194 lines
9.1 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:WPFDark">
<Style x:Key="RepeatButtonTransparentStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Grid>
<Rectangle Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Fill="{TemplateBinding Background}" />
<ContentPresenter />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="SliderThumbHorizontalDefault" TargetType="{x:Type Thumb}">
<Rectangle x:Name="grip"
Width="32.0"
Height="8.0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{DynamicResource AccentBrushKey}"
RadiusX="4.0"
RadiusY="4.0"
SnapsToDevicePixels="True"
Stretch="Fill"
StrokeThickness="0.0"
UseLayoutRounding="True" />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource AccentBrushKey.IsMouseOver}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource InactiveControlBrushKey}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderHorizontal" TargetType="{x:Type Slider}">
<Grid>
<Rectangle x:Name="TrackBackground"
Height="4.0"
VerticalAlignment="Center"
Fill="{DynamicResource PanelBackgroundBrushKey}" />
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}">
<Rectangle Height="4.0"
Margin="0,0,-4,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Fill" Value="{DynamicResource AccentBrushKey.SliderRail}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Fill" Value="{x:Null}" />
</Trigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Width="32.0"
Height="8.0"
VerticalAlignment="Center"
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource SliderThumbHorizontalDefault}" />
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="TrackBackground" Property="Fill" Value="{DynamicResource PanelBackgroundBrushKey.MouseOver}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderThumbVerticalDefault" TargetType="{x:Type Thumb}">
<Rectangle x:Name="grip"
Width="8.0"
Height="32.0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{DynamicResource AccentBrushKey}"
RadiusX="4.0"
RadiusY="4.0"
SnapsToDevicePixels="True"
Stretch="Fill"
StrokeThickness="0.0"
UseLayoutRounding="True" />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource AccentBrushKey.IsMouseOver}" />
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource AccentBrushKey.IsMouseOver}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource InactiveControlBrushKey}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderVertical" TargetType="{x:Type Slider}">
<Grid>
<Rectangle x:Name="TrackBackground"
Width="4.0"
HorizontalAlignment="Center"
Fill="{DynamicResource PanelBackgroundBrushKey}" />
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}">
<Rectangle Width="4.0"
Margin="0,-4,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Stretch">
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Fill" Value="{DynamicResource AccentBrushKey.SliderRail}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Fill" Value="{x:Null}" />
</Trigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparentStyle}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb"
Width="8.0"
Height="32.0"
VerticalAlignment="Top"
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource SliderThumbVerticalDefault}" />
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="TrackBackground" Property="Fill" Value="{DynamicResource PanelBackgroundBrushKey.MouseOver}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Template" Value="{StaticResource SliderHorizontal}" />
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource SliderVertical}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>