<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:c1="using:C1.Xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/Common.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <!--  ******************** C1RangeSlider ********************  -->

    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Default">
            <SolidColorBrush x:Key="RangeSliderThumbPointerOverBackgroundThemeBrush" Color="#80000000"/>
            <SolidColorBrush x:Key="RangeSliderThumbPressedBackgroundThemeBrush" Color="#33000000"/>
            <Thickness x:Key="RangeSliderHorizontalThumbBorderThickness">0</Thickness>
            <Thickness x:Key="RangeSliderVerticalThumbBorderThickness">0</Thickness>
            <Thickness x:Key="RangeSliderBorderThickness">0</Thickness>
        </ResourceDictionary>
        <ResourceDictionary x:Key="Light">
            <SolidColorBrush x:Key="RangeSliderThumbPointerOverBackgroundThemeBrush" Color="#80FFFFFF"/>
            <SolidColorBrush x:Key="RangeSliderThumbPressedBackgroundThemeBrush" Color="#59FFFFFF"/>
            <Thickness x:Key="RangeSliderHorizontalThumbBorderThickness">0</Thickness>
            <Thickness x:Key="RangeSliderVerticalThumbBorderThickness">0</Thickness>
            <Thickness x:Key="RangeSliderBorderThickness">0</Thickness>
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrast">
            <SolidColorBrush x:Key="RangeSliderThumbPointerOverBackgroundThemeBrush" Color="#FF008000"/>
            <SolidColorBrush x:Key="RangeSliderThumbPressedBackgroundThemeBrush" Color="#FFFFFFFF"/>
            <Thickness x:Key="RangeSliderHorizontalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderVerticalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderBorderThickness">1</Thickness>
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrastBlack">
            <SolidColorBrush x:Key="RangeSliderThumbPointerOverBackgroundThemeBrush" Color="#FF1AEBFF"/>
            <SolidColorBrush x:Key="RangeSliderThumbPressedBackgroundThemeBrush" Color="#FF000000"/>
            <Thickness x:Key="RangeSliderHorizontalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderVerticalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderBorderThickness">1</Thickness>
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrastWhite">
            <SolidColorBrush x:Key="RangeSliderThumbPointerOverBackgroundThemeBrush" Color="#FF37006E"/>
            <SolidColorBrush x:Key="RangeSliderThumbPressedBackgroundThemeBrush" Color="#FFFFFFFF"/>
            <Thickness x:Key="RangeSliderHorizontalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderVerticalThumbBorderThickness">1</Thickness>
            <Thickness x:Key="RangeSliderBorderThickness">1</Thickness>
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>

    <!--  CornerRadius @ RangeSlider Thumb  -->
    <CornerRadius x:Key="RangeSliderThumbCornerRadius">0</CornerRadius>

    <!--  C1RangeSlider Thumb Style for Horizontal Orientation  -->
    <Style x:Key="RangeSliderHorizontalThumbStyle" TargetType="Thumb">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid MinHeight="10" Width="10" >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="MouseOverElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="PressedElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement" Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Null}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="DisabledVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="FocusedVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="BackgroundElement"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{StaticResource RangeSliderHorizontalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"/>
                        <Border x:Name="MouseOverElement"
                                Background="{TemplateBinding c1:ClearStyleExtensions.MouseOverBrush}"
                                BorderThickness="{StaticResource RangeSliderHorizontalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed"/>
                        <Border x:Name="FocusedVisualElement"
                                BorderBrush="{TemplateBinding c1:ClearStyleExtensions.FocusBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed" />
                        <Border x:Name="PressedElement"
                                Background="{TemplateBinding c1:ClearStyleExtensions.PressedBrush}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{StaticResource RangeSliderHorizontalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed"/>
                        <Border x:Name="DisabledVisualElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  C1RangeSlider Thumb Style for Vertical Orientation  -->
    <Style x:Key="RangeSliderVerticalThumbStyle" TargetType="Thumb">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid  MinWidth="10" Height="10">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="MouseOverElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="PressedElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="DisabledVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="FocusedVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="BackgroundElement"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{StaticResource RangeSliderVerticalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"/>
                        <Border x:Name="MouseOverElement"
                                Background="{TemplateBinding c1:ClearStyleExtensions.MouseOverBrush}"
                                BorderThickness="{StaticResource RangeSliderVerticalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed"/>
                        <Border x:Name="FocusedVisualElement"
                                BorderBrush="{TemplateBinding c1:ClearStyleExtensions.FocusBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed" />
                        <Border x:Name="PressedElement"
                                Background="{TemplateBinding c1:ClearStyleExtensions.PressedBrush}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{StaticResource RangeSliderVerticalThumbBorderThickness}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed"/>
                        <Border x:Name="DisabledVisualElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="{StaticResource RangeSliderThumbCornerRadius}"
                                Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="c1:C1RangeSlider">
        <Setter Property="Background" Value="{ThemeResource SliderTrackBackgroundThemeBrush}" />
        <Setter Property="MouseOverBrush" Value="{ThemeResource RangeSliderThumbPointerOverBackgroundThemeBrush}" />
        <Setter Property="PressedBrush" Value="{ThemeResource RangeSliderThumbPressedBackgroundThemeBrush}" />
        <Setter Property="Foreground" Value="{ThemeResource SliderTrackDecreaseBackgroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource SliderBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{StaticResource RangeSliderBorderThickness}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1RangeSlider">
                    <Grid x:Name="Root"
                          Width="{TemplateBinding Width}"
                          Height="{TemplateBinding Height}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="DisabledVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="VDisabledVisualElement"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Duration="00:00:00.0010000"
                                                                       Storyboard.TargetName="FocusVisual"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <!--  Horizontal Template  -->
                        <Grid x:Name="HorizontalTemplate">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Border Grid.ColumnSpan="5"
                                       Background="{TemplateBinding Background}"
                                       BorderBrush="{TemplateBinding BorderBrush}"
                                       BorderThickness="{TemplateBinding BorderThickness}"
                                       Visibility="{TemplateBinding RangeSliderBarVisibility}" />
                            <Border x:Name="DisabledVisualElement"
                                    Grid.ColumnSpan="5"
                                    Background="{StaticResource DisabledBrush}"
                                    Visibility="Collapsed" />
                            <!--  Repeat Buttons + Thumb  -->
                            <RepeatButton x:Name="DecreaseRepeatButton"
                                          Background="Transparent"
                                          IsTabStop="False"
                                          Opacity="0" />
                            <Thumb x:Name="LowerThumb"
                                   Grid.Column="1"
                                   Background="{ThemeResource SliderThumbBackgroundThemeBrush}"
                                   BorderBrush="{TemplateBinding BorderBrush}"
                                   Style="{StaticResource RangeSliderHorizontalThumbStyle}"
                                   c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}"
                                   c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                   c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" />
                            <Border Grid.Column="2" Background="{TemplateBinding Foreground}"/>
                            <Thumb x:Name="MiddleThumb"
                                   Grid.Column="2"
                                   Background="Transparent"
                                   IsTabStop="False"
                                   Opacity="0" />                           
                            <Thumb x:Name="UpperThumb"
                                   Grid.Column="3"
                                   Background="{ThemeResource SliderThumbBackgroundThemeBrush}"
                                   BorderBrush="{TemplateBinding BorderBrush}"
                                   Style="{StaticResource RangeSliderHorizontalThumbStyle}"
                                   c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}"
                                   c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                   c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" />
                            <RepeatButton x:Name="IncreaseRepeatButton"
                                          Grid.Column="4"
                                          Background="Transparent"
                                          IsTabStop="False"
                                          Opacity="0" />
                        </Grid>

                        <!--  Vertical Template  -->
                        <Grid x:Name="VerticalTemplate">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Border Grid.RowSpan="5"
                                       Background="{TemplateBinding Background}"
                                       BorderBrush="{TemplateBinding BorderBrush}"
                                       BorderThickness="{TemplateBinding BorderThickness}"
                                       Visibility="{TemplateBinding RangeSliderBarVisibility}" />
                            <Border x:Name="VDisabledVisualElement"
                                    Grid.RowSpan="5"
                                    Background="{StaticResource DisabledBrush}"
                                    Visibility="Collapsed" />
                            <!--  Repeat Buttons + Thumb  -->
                            <RepeatButton x:Name="VerticalIncreaseRepeatButton"
                                          Background="Transparent"
                                          IsTabStop="False"
                                          Opacity="0" />
                            <Thumb x:Name="VerticalUpperThumb"
                                   Grid.Row="1"
                                   Background="{ThemeResource SliderThumbBackgroundThemeBrush}"
                                   BorderBrush="{TemplateBinding BorderBrush}"
                                   BorderThickness="{TemplateBinding BorderThickness}"
                                   Style="{StaticResource RangeSliderVerticalThumbStyle}"
                                   c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}"
                                   c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                   c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" />
                            <Border Grid.Row="2" Background="{TemplateBinding Foreground}"/>
                            <Thumb x:Name="VerticalMiddleThumb"
                                   Grid.Row="2"
                                   Background="Transparent"
                                   IsTabStop="False"
                                   Opacity="0" />                            
                            <Thumb x:Name="VerticalLowerThumb"
                                   Grid.Row="3"
                                   Background="{ThemeResource SliderThumbBackgroundThemeBrush}"
                                   BorderBrush="{TemplateBinding BorderBrush}"
                                   BorderThickness="{TemplateBinding BorderThickness}"
                                   Style="{StaticResource RangeSliderVerticalThumbStyle}"
                                   c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}"
                                   c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}"
                                   c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" />
                            <RepeatButton x:Name="VerticalDecreaseRepeatButton"
                                          Grid.Row="4"
                                          Background="Transparent"
                                          IsTabStop="False"
                                          Opacity="0" />
                        </Grid>
                        <!--  Focus indicator  -->
                        <Border x:Name="FocusVisual"
                                BorderBrush="{TemplateBinding FocusBrush}"
                                BorderThickness="1"
                                IsHitTestVisible="False"
                                Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
