mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-08 02:06:37 +08:00
278 lines
15 KiB
XML
278 lines
15 KiB
XML
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
<ControlTheme x:Key="SliderHorizontalRepeatButton" TargetType="RepeatButton">
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="RepeatButton">
|
|
<Grid>
|
|
<Border
|
|
Name="FocusTarget"
|
|
Margin="0,-10"
|
|
Background="Transparent" />
|
|
<Border
|
|
Name="TrackBackground"
|
|
Height="{DynamicResource SliderTrackWidth}"
|
|
Margin="{TemplateBinding Margin}"
|
|
VerticalAlignment="Center"
|
|
Background="{TemplateBinding Background}"
|
|
CornerRadius="{DynamicResource SliderTrackCornerRadius}" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="SliderVerticalRepeatButton" TargetType="RepeatButton">
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="RepeatButton">
|
|
<Grid>
|
|
<Border
|
|
Name="FocusTarget"
|
|
Margin="0,-10"
|
|
Background="Transparent" />
|
|
<Border
|
|
Name="TrackBackground"
|
|
Width="{DynamicResource SliderTrackWidth}"
|
|
Margin="{TemplateBinding Margin}"
|
|
HorizontalAlignment="Center"
|
|
Background="{TemplateBinding Background}"
|
|
CornerRadius="{DynamicResource SliderTrackCornerRadius}" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="SliderThumbTheme" TargetType="Thumb">
|
|
<Setter Property="CornerRadius" Value="{DynamicResource SliderThumbCornerRadius}" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="Background" Value="{DynamicResource SliderThumbBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{DynamicResource SliderThumbBorderThickness}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="Thumb">
|
|
<Border
|
|
Width="{TemplateBinding Width}"
|
|
Height="{TemplateBinding Height}"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
</ControlTemplate>
|
|
</Setter>
|
|
<Style Selector="^:pointerover">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbPointeroverBorderBrush}" />
|
|
</Style>
|
|
<Style Selector="^:pressed">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbPressedBorderBrush}" />
|
|
</Style>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="{x:Type Slider}" TargetType="Slider">
|
|
<Setter Property="Background" Value="{DynamicResource SliderTrackBackground}" />
|
|
<Setter Property="BorderThickness" Value="{DynamicResource SliderBorderThickness}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource SliderTrackForeground}" />
|
|
<Style Selector="^:horizontal">
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="Slider">
|
|
<DataValidationErrors>
|
|
<Grid
|
|
Name="SliderContainer"
|
|
Margin="{TemplateBinding Padding}"
|
|
Background="Transparent"
|
|
RowDefinitions="Auto,Auto,Auto">
|
|
<Grid.Styles>
|
|
<Style Selector="TickBar">
|
|
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" />
|
|
</Style>
|
|
</Grid.Styles>
|
|
<TickBar
|
|
Name="TopTickBar"
|
|
Grid.Row="0"
|
|
Height="{DynamicResource SliderTickHorizontalHeight}"
|
|
Margin="0,0,0,4"
|
|
VerticalAlignment="Bottom"
|
|
Fill="{DynamicResource SliderTickForeground}"
|
|
IsVisible="False"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="{TemplateBinding Orientation}"
|
|
Placement="Top"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
TickFrequency="{TemplateBinding TickFrequency}"
|
|
Ticks="{TemplateBinding Ticks}" />
|
|
<TickBar
|
|
Name="BottomTickBar"
|
|
Grid.Row="2"
|
|
Height="{DynamicResource SliderTickHorizontalHeight}"
|
|
Margin="0,4,0,0"
|
|
VerticalAlignment="Top"
|
|
Fill="{DynamicResource SliderTickForeground}"
|
|
IsVisible="False"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="{TemplateBinding Orientation}"
|
|
Placement="Bottom"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
TickFrequency="{TemplateBinding TickFrequency}"
|
|
Ticks="{TemplateBinding Ticks}" />
|
|
<Track
|
|
Name="PART_Track"
|
|
Grid.Row="1"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="Horizontal"
|
|
Value="{TemplateBinding Value,
|
|
Mode=TwoWay}">
|
|
<Track.DecreaseButton>
|
|
<RepeatButton
|
|
Name="PART_DecreaseButton"
|
|
Background="{TemplateBinding Foreground}"
|
|
Focusable="False"
|
|
Theme="{StaticResource SliderHorizontalRepeatButton}" />
|
|
</Track.DecreaseButton>
|
|
<Track.IncreaseButton>
|
|
<RepeatButton
|
|
Name="PART_IncreaseButton"
|
|
Background="{TemplateBinding Background}"
|
|
Focusable="False"
|
|
Theme="{StaticResource SliderHorizontalRepeatButton}" />
|
|
</Track.IncreaseButton>
|
|
<Thumb
|
|
Name="thumb"
|
|
Width="{DynamicResource SliderThumbWidth}"
|
|
Height="{DynamicResource SliderThumbHeight}"
|
|
DataContext="{TemplateBinding Value}"
|
|
Theme="{StaticResource SliderThumbTheme}" />
|
|
</Track>
|
|
</Grid>
|
|
</DataValidationErrors>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
<Style Selector="^:vertical">
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<DataValidationErrors>
|
|
<Grid
|
|
Name="SliderContainer"
|
|
Margin="{TemplateBinding Padding}"
|
|
Background="{DynamicResource SliderContainerBackground}"
|
|
ColumnDefinitions="Auto,Auto,Auto">
|
|
<Grid.Styles>
|
|
<Style Selector="TickBar">
|
|
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" />
|
|
</Style>
|
|
</Grid.Styles>
|
|
<TickBar
|
|
Name="LeftTickBar"
|
|
Grid.Column="0"
|
|
Width="{DynamicResource SliderTickVerticalWidth}"
|
|
Margin="0,0,4,0"
|
|
HorizontalAlignment="Right"
|
|
Fill="{DynamicResource SliderTickForeground}"
|
|
IsVisible="False"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="{TemplateBinding Orientation}"
|
|
Placement="Left"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
TickFrequency="{TemplateBinding TickFrequency}"
|
|
Ticks="{TemplateBinding Ticks}" />
|
|
<TickBar
|
|
Name="RightTickBar"
|
|
Grid.Column="2"
|
|
Width="{DynamicResource SliderTickVerticalWidth}"
|
|
Margin="4,0,0,0"
|
|
HorizontalAlignment="Left"
|
|
Fill="{DynamicResource SliderTickForeground}"
|
|
IsVisible="False"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="{TemplateBinding Orientation}"
|
|
Placement="Right"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
TickFrequency="{TemplateBinding TickFrequency}"
|
|
Ticks="{TemplateBinding Ticks}" />
|
|
<Track
|
|
Name="PART_Track"
|
|
Grid.Column="1"
|
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
|
Maximum="{TemplateBinding Maximum}"
|
|
Minimum="{TemplateBinding Minimum}"
|
|
Orientation="Vertical"
|
|
Value="{TemplateBinding Value,
|
|
Mode=TwoWay}">
|
|
<Track.DecreaseButton>
|
|
<RepeatButton
|
|
Name="PART_DecreaseButton"
|
|
Background="{TemplateBinding Foreground}"
|
|
Focusable="False"
|
|
Theme="{StaticResource SliderVerticalRepeatButton}" />
|
|
</Track.DecreaseButton>
|
|
<Track.IncreaseButton>
|
|
<RepeatButton
|
|
Name="PART_IncreaseButton"
|
|
Background="{TemplateBinding Background}"
|
|
Focusable="False"
|
|
Theme="{StaticResource SliderVerticalRepeatButton}" />
|
|
</Track.IncreaseButton>
|
|
<Thumb
|
|
Name="thumb"
|
|
Width="{DynamicResource SliderThumbWidth}"
|
|
Height="{DynamicResource SliderThumbHeight}"
|
|
DataContext="{TemplateBinding Value}"
|
|
Theme="{StaticResource SliderThumbTheme}" />
|
|
</Track>
|
|
</Grid>
|
|
</DataValidationErrors>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style Selector="^.ToolTip /template/ Thumb">
|
|
<Setter Property="ToolTip.Tip" Value="{Binding $parent[Slider].Value, Mode=OneWay, StringFormat='\{0:f\}'}" />
|
|
<Setter Property="ToolTip.Placement" Value="Top" />
|
|
<Setter Property="ToolTip.VerticalOffset" Value="-10" />
|
|
<Setter Property="ToolTip.HorizontalOffset" Value="-15" />
|
|
</Style>
|
|
|
|
<!-- TickBar Placement States -->
|
|
|
|
<Style Selector="^[TickPlacement=TopLeft] /template/ TickBar#LeftTickBar, ^[TickPlacement=Outside] /template/ TickBar#LeftTickBar">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
|
|
<Style Selector="^[TickPlacement=TopLeft] /template/ TickBar#TopTickBar, ^[TickPlacement=Outside] /template/ TickBar#TopTickBar">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
|
|
<Style Selector="^[TickPlacement=BottomRight] /template/ TickBar#BottomTickBar, ^[TickPlacement=Outside] /template/ TickBar#BottomTickBar">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
|
|
<Style Selector="^[TickPlacement=BottomRight] /template/ TickBar#RightTickBar, ^[TickPlacement=Outside] /template/ TickBar#RightTickBar">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
|
|
<Style Selector="^:error /template/ Thumb#thumb">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
|
</Style>
|
|
|
|
<!-- Disabled State -->
|
|
|
|
<Style Selector="^:disabled">
|
|
<Style Selector="^ /template/ RepeatButton#PART_DecreaseButton">
|
|
<Setter Property="Background" Value="{DynamicResource SliderTrackDisabledForeground}" />
|
|
</Style>
|
|
|
|
<Style Selector="^ /template/ RepeatButton#PART_IncreaseButton">
|
|
<Setter Property="Background" Value="{DynamicResource SliderTrackDisabledBackground}" />
|
|
</Style>
|
|
|
|
<Style Selector="^ /template/ Thumb">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbDisabledBorderBrush}" />
|
|
</Style>
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
</ResourceDictionary> |