<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:C1.Xaml.Chart.Interaction"
    xmlns:c1="using:C1.Xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/Common.xaml"/>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/C1RangeSlider.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <c1:VisibilityConverter x:Key="VisibilityConverter" />
    <SolidColorBrush x:Key="AxisScrollbarBackground" Color="LightGray" />
    <SolidColorBrush x:Key="SelectedAreaBrush" Color="Gray" />
    <Style TargetType="local:C1AxisScrollbar">
    <Setter Property="Background" Value="{StaticResource AxisScrollbarBackground}" />
    <Setter Property="ScrollBehavior" Value="Range" />
    <Setter Property="RangeSliderBarVisibility" Value="Collapsed" />
    <Setter Property="SelectedAreaBrush" Value="{StaticResource SelectedAreaBrush}" />
    <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="local:C1AxisScrollbar">
                <Grid x:Name="Root"
                              Width="{TemplateBinding Width}"
                              Height="{TemplateBinding Height}"
                              Background="{TemplateBinding Background}">
                    <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="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Border Grid.ColumnSpan="5"
                                           Background="{TemplateBinding Background}"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}"
                                           Visibility="{TemplateBinding RangeSliderBarVisibility}" />
                        <Border x:Name="DisabledVisualElement"
                                        Grid.ColumnSpan="7"
                                        Background="{StaticResource DisabledBrush}"
                                        Visibility="Collapsed" />
                        <RepeatButton x:Name="DecreaseButton" Content="&#xE016;" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="Segoe UI symbol" Visibility="{Binding Path=ScrollButtonsVisible, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource VisibilityConverter}}"/>
                        <!--  Repeat Buttons + Thumb  -->
                        <RepeatButton x:Name="DecreaseRepeatButton"
                                              Background="Transparent"
                                              IsTabStop="False"
                                              HorizontalAlignment="Stretch"
                                              VerticalAlignment="Stretch"
                                              Opacity="0" Grid.Column="1" />
                        <Thumb x:Name="LowerThumb"
                                       Grid.Column="2"
                                       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="3" Background="{TemplateBinding SelectedAreaBrush}"/>
                        <Thumb x:Name="MiddleThumb"
                                       Grid.Column="3"
                                       Background="Transparent"
                                       IsTabStop="False"
                                       Opacity="0" />
                        <Thumb x:Name="UpperThumb"
                                       Grid.Column="4"
                                       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="5"
                                              Background="Transparent"
                                              IsTabStop="False"
                                              HorizontalAlignment="Stretch"
                                              VerticalAlignment="Stretch"
                                              Opacity="0" />
                        <RepeatButton x:Name="IncreaseButton" Content="&#xE017;" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="Segoe UI symbol" Visibility="{Binding Path=ScrollButtonsVisible, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource VisibilityConverter}}" Grid.Column="6" />
                    </Grid>

                    <!--  Vertical Template  -->
                    <Grid x:Name="VerticalTemplate">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </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" />
                        <RepeatButton x:Name="VerticalDecreaseButton" Content="&#xE019;" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="Segoe UI symbol" Visibility="{Binding ScrollButtonsVisible, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource VisibilityConverter}}" Grid.Row="6"/>
                        <!--  Repeat Buttons + Thumb  -->
                        <RepeatButton x:Name="VerticalIncreaseRepeatButton"
                                              Background="Transparent"
                                              IsTabStop="False"
                                              VerticalAlignment="Stretch"
                                              HorizontalAlignment="Stretch"
                                              Opacity="0" Grid.Row="1"/>
                        <Thumb x:Name="VerticalUpperThumb"
                                       Grid.Row="2"
                                       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="3" Background="{TemplateBinding SelectedAreaBrush}"/>
                        <Thumb x:Name="VerticalMiddleThumb"
                                       Grid.Row="3"
                                       Background="Transparent"
                                       IsTabStop="False"
                                       Opacity="0" />
                        <Thumb x:Name="VerticalLowerThumb"
                                       Grid.Row="4"
                                       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="5"
                                              Background="Transparent"
                                              IsTabStop="False"
                                              VerticalAlignment="Stretch"
                                              HorizontalAlignment="Stretch"
                                              Opacity="0" />
                        <RepeatButton x:Name="VerticalIncreaseButton" Content="&#xE018;" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontFamily="Segoe UI symbol" Visibility="{Binding ScrollButtonsVisible, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource VisibilityConverter}}" />
                    </Grid>
                    <!--  Focus indicator  -->
                    <Border x:Name="FocusVisual"
                                    BorderBrush="{TemplateBinding FocusBrush}"
                                    BorderThickness="1"
                                    IsHitTestVisible="False"
                                    Visibility="Collapsed" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
</ResourceDictionary>
