<ResourceDictionary
    x:ClassModifier="internal"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ControlTheme TargetType="RepeatButton" x:Key="SliderDecreaseTheme">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Height" Value="12" />
        <Setter Property="Template">
            <ControlTemplate>
                <Border Background="{DynamicResource AccentColor}" Name="DecreaseThemeBorder" />
            </ControlTemplate>
        </Setter>
    </ControlTheme>
    <ControlTheme TargetType="RepeatButton" x:Key="SliderIncreaseTheme">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Height" Value="12" />
        <Setter Property="Template">
            <ControlTemplate>
                <Border
                    Background="{DynamicResource AccentColor}"
                    Name="IncreaseThemeBorder"
                    Opacity="0.2" />
            </ControlTemplate>
        </Setter>
    </ControlTheme>

    <ControlTheme TargetType="Slider" x:Key="{x:Type Slider}">
        <Style Selector="^:horizontal">
            <Setter Property="MinWidth" Value="40" />
            <Setter Property="MinHeight" Value="20" />
            <Setter Property="Template">
                <ControlTemplate>
                    <Grid Name="grid">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" MinHeight="20" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Track
                            Grid.Row="1"
                            IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                            Name="PART_Track"
                            Orientation="Horizontal">
                            <Track.DecreaseButton>
                                <RepeatButton Name="PART_DecreaseButton" Theme="{StaticResource SliderDecreaseTheme}" />
                            </Track.DecreaseButton>
                            <Track.IncreaseButton>
                                <RepeatButton Name="PART_IncreaseButton" Theme="{StaticResource SliderIncreaseTheme}" />
                            </Track.IncreaseButton>
                            <Thumb Height="22" Width="22">
                                <Thumb.Template>
                                    <ControlTemplate>
                                        <Rectangle
                                            Fill="{DynamicResource MainButtonBackgroundColor}"
                                            Name="thumb"
                                            Stroke="{DynamicResource MainBorderColor}"
                                            StrokeThickness="1.5" />
                                    </ControlTemplate>
                                </Thumb.Template>
                                <Thumb.Styles>
                                    <Style Selector="Rectangle:pointerover">
                                        <Setter Property="Fill" Value="{DynamicResource AccentColor}" />
                                    </Style>
                                </Thumb.Styles>
                            </Thumb>
                        </Track>
                    </Grid>
                </ControlTemplate>
            </Setter>
        </Style>

        <Style Selector="^ /template/ Track#PART_Track">
            <Setter Property="Minimum" Value="{TemplateBinding Minimum}" />
            <Setter Property="Maximum" Value="{TemplateBinding Maximum}" />
            <Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}" />
        </Style>
        <Style Selector="^:disabled /template/ Grid#grid">
            <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
        </Style>
    </ControlTheme>

    <ControlTheme TargetType="Slider" x:Key="SetBg">
        <Style Selector="^:horizontal">
            <Setter Property="MinWidth" Value="40" />
            <Setter Property="MinHeight" Value="20" />
            <Setter Property="Template">
                <ControlTemplate>
                    <Grid Name="grid">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" MinHeight="20" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Border
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding CornerRadius}"
                            Grid.Row="1"
                            Height="14"
                            VerticalAlignment="Center" />
                        <Track
                            Grid.Row="1"
                            IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                            Name="PART_Track"
                            Orientation="Horizontal">
                            <Track.DecreaseButton>
                                <RepeatButton
                                    Background="Transparent"
                                    Height="12"
                                    Name="PART_DecreaseButton" />
                            </Track.DecreaseButton>
                            <Track.IncreaseButton>
                                <RepeatButton
                                    Background="Transparent"
                                    Height="12"
                                    Name="PART_IncreaseButton" />
                            </Track.IncreaseButton>
                            <Thumb Height="22" Width="22">
                                <Thumb.Template>
                                    <ControlTemplate>
                                        <Rectangle
                                            Fill="{DynamicResource SecondaryButtonBackgroundColor}"
                                            Name="thumb"
                                            Stroke="{DynamicResource MainBorderColor}"
                                            StrokeThickness="1.5" />
                                    </ControlTemplate>
                                </Thumb.Template>
                                <Thumb.Styles>
                                    <Style Selector="Rectangle:pointerover">
                                        <Setter Property="Fill" Value="{DynamicResource AccentColor}" />
                                    </Style>
                                </Thumb.Styles>
                            </Thumb>
                        </Track>
                    </Grid>
                </ControlTemplate>
            </Setter>
        </Style>

        <Style Selector="^ /template/ Track#PART_Track">
            <Setter Property="Minimum" Value="{TemplateBinding Minimum}" />
            <Setter Property="Maximum" Value="{TemplateBinding Maximum}" />
            <Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}" />
        </Style>
        <Style Selector="^:disabled /template/ Grid#grid">
            <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
        </Style>
    </ControlTheme>
</ResourceDictionary>