<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderButtonRightStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Height" Value="7.5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{StaticResource AltInterfaceBrush}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Height" Value="17" />
        <Setter Property="Width" Value="25" />
        <Setter Property="Opacity" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Rectangle
                        x:Name="Ellipse"
                        Fill="{StaticResource BackgroundColorBrush}"
                        Stroke="{StaticResource BorderBrush}"
                        StrokeThickness="1.5" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource ChosenColorBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Ellipse" Property="Opacity" Value=".9" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Template when the orientation of the Slider is Horizontal.  -->
    <ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TickBar
                x:Name="TopTick"
                Height="7.5"
                Placement="Top"
                SnapsToDevicePixels="True"
                Visibility="Collapsed">
                <TickBar.Fill>
                    <SolidColorBrush Color="{DynamicResource ChosenColor}" />
                </TickBar.Fill>
            </TickBar>
            <Border
                x:Name="TrackBackground"
                Grid.Row="1"
                Height="7.5"
                Margin="0"
                Background="{DynamicResource ChosenColorBrush}"
                BorderBrush="{StaticResource BorderBrush}"
                BorderThickness="1"
                CornerRadius="1" />
            <Track x:Name="PART_Track" Grid.Row="1">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="Slider.DecreaseLarge" Style="{StaticResource SliderButtonStyle}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource SliderThumbStyle}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="Slider.IncreaseLarge" Style="{StaticResource SliderButtonRightStyle}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar
                x:Name="BottomTick"
                Grid.Row="2"
                Height="4"
                Fill="{TemplateBinding Foreground}"
                Opacity=".9"
                Placement="Bottom"
                SnapsToDevicePixels="True"
                Visibility="Collapsed" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="TickPlacement" Value="TopLeft">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="TickPlacement" Value="BottomRight">
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="TickPlacement" Value="Both">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="TrackBackground" Property="Background" Value="{StaticResource MainColorFadedBrush}" />
                <Setter TargetName="TrackBackground" Property="Opacity" Value=".8" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--  Template when the orientation of the Slider is Vertical.  -->
    <ControlTemplate x:Key="VerticalSlider" TargetType="{x:Type Slider}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TickBar
                x:Name="TopTick"
                Width="4"
                Fill="{DynamicResource ChosenColorBrush}"
                Placement="Left"
                SnapsToDevicePixels="True"
                Visibility="Collapsed" />

            <Border
                x:Name="TrackBackground"
                Grid.Column="1"
                Width="4"
                Margin="0"
                Background="{DynamicResource ChosenColorBrush}"
                BorderBrush="{StaticResource BorderBrushAlt}"
                BorderThickness="1"
                CornerRadius="2" />
            <Track x:Name="PART_Track" Grid.Column="1">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="Slider.DecreaseLarge" Style="{StaticResource SliderButtonStyle}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource SliderThumbStyle}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="Slider.IncreaseLarge" Style="{StaticResource SliderButtonStyle}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar
                x:Name="BottomTick"
                Grid.Column="2"
                Width="4"
                Fill="{TemplateBinding Foreground}"
                Opacity=".9"
                Placement="Right"
                SnapsToDevicePixels="True"
                Visibility="Collapsed" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="TickPlacement" Value="TopLeft">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="TickPlacement" Value="BottomRight">
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="TickPlacement" Value="Both">
                <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
                <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Slider}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinWidth" Value="104" />
                <Setter Property="MinHeight" Value="21" />
                <Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="MinWidth" Value="21" />
                <Setter Property="MinHeight" Value="104" />
                <Setter Property="Template" Value="{StaticResource VerticalSlider}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>