<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:C1.WPF.Chart.Interaction"
    xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/C1.WPF.4;component/themes/Common.xaml" />
        <ResourceDictionary Source="/C1.WPF.4;component/themes/C1RangeSlider.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="RangeSliderHorizontalThumbStyle" TargetType="Thumb">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid>
                        <Path Stroke="DimGray" Fill="LightGray" VerticalAlignment="Center">
                            <Path.Data>
                                <GeometryGroup>
                                    <EllipseGeometry RadiusX="10" RadiusY="10" Center="10, 10"/>
                                    <LineGeometry StartPoint="9, 5" EndPoint="9, 15"/>
                                    <LineGeometry StartPoint="11, 5" EndPoint="11, 15" />
                                </GeometryGroup>
                            </Path.Data>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RangeSliderVerticalThumbStyle" TargetType="Thumb">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid>
                        <Path Stroke="DimGray" Fill="LightGray" HorizontalAlignment="Center">
                            <Path.Data>
                                <GeometryGroup>
                                    <EllipseGeometry RadiusX="10" RadiusY="10" Center="10, 10"/>
                                    <LineGeometry StartPoint="5, 9" EndPoint="15, 9"/>
                                    <LineGeometry StartPoint="5, 11" EndPoint="15, 11" />
                                </GeometryGroup>
                            </Path.Data>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:C1RangeSelector}">
        <Setter Property="SelectedAreaBrush" Value="Gray" />
        <Setter Property="RangeSliderBarVisibility" Value="Collapsed" />
        <Setter Property="ScrollBehavior" Value="None" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:C1RangeSelector}">
                    <Grid x:Name="Root" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisabledVisualElement">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="VDisabledVisualElement">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalTemplate" Margin="{TemplateBinding BorderThickness}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <c1:C1BrushBuilder x:Name="HBackgroundBrush" DesignBrush="#FFEDEDED" DesignColor="#FFD1DCE8" ExtrapolationMethod="Absolute" IsHitTestVisible="False" Input="{TemplateBinding Background}" Visibility="Collapsed"/>
                            <Rectangle Grid.ColumnSpan="5" Fill="{Binding Output, ElementName=HBackgroundBrush}" Stroke="{TemplateBinding BorderBrush}" Visibility="{TemplateBinding RangeSliderBarVisibility}">
                                <Rectangle.Style>
                                    <Style TargetType="{x:Type Rectangle}">
                                        <Setter Property="StrokeThickness" Value="1"/>
                                        <Setter Property="RadiusX" Value="1"/>
                                        <Setter Property="RadiusY" Value="1"/>
                                        <Setter Property="Height" Value="3"/>
                                        <Setter Property="Margin" Value="5,0"/>
                                    </Style>
                                </Rectangle.Style>
                            </Rectangle>
                            <Border x:Name="DisabledVisualElement" Background="#77E8E8E8" Grid.ColumnSpan="5" Visibility="Collapsed"/>
                            <RepeatButton x:Name="DecreaseRepeatButton" Background="Transparent" IsTabStop="False" Opacity="0"/>
                            <Thumb x:Name="LowerThumb" Panel.ZIndex="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}" c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}" c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" Style="{StaticResource RangeSliderHorizontalThumbStyle}"/>
                            <Thumb x:Name="MiddleThumb" Background="Transparent" Margin="-10 0" Panel.ZIndex="1" Grid.Column="2" IsTabStop="False" Opacity="0"/>
                            <Border Background="{TemplateBinding SelectedAreaBrush}" Grid.Column="2" Opacity="0.5" Margin="-10 0" />
                            <Thumb x:Name="UpperThumb" Panel.ZIndex="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="3" c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}" c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}" c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" Style="{StaticResource RangeSliderHorizontalThumbStyle}"/>
                            <RepeatButton x:Name="IncreaseRepeatButton" Background="Transparent" Grid.Column="4" IsTabStop="False" Opacity="0"/>
                        </Grid>
                        <Grid x:Name="VerticalTemplate" Margin="{TemplateBinding BorderThickness}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <c1:C1BrushBuilder x:Name="VBackgroundBrush" DesignBrush="#FFEDEDED" DesignColor="#FFD1DCE8" ExtrapolationMethod="Absolute" IsHitTestVisible="False" Input="{TemplateBinding Background}" Visibility="Collapsed"/>
                            <Rectangle Fill="{Binding Output, ElementName=VBackgroundBrush}" Grid.RowSpan="5" Stroke="{TemplateBinding BorderBrush}" Visibility="{TemplateBinding RangeSliderBarVisibility}">
                                <Rectangle.Style>
                                    <Style TargetType="{x:Type Rectangle}">
                                        <Setter Property="StrokeThickness" Value="1"/>
                                        <Setter Property="RadiusX" Value="1"/>
                                        <Setter Property="RadiusY" Value="1"/>
                                        <Setter Property="Width" Value="3"/>
                                        <Setter Property="Margin" Value="0,5"/>
                                    </Style>
                                </Rectangle.Style>
                            </Rectangle>
                            <Border x:Name="VDisabledVisualElement" Background="#77E8E8E8" Grid.RowSpan="5" Visibility="Collapsed"/>
                            <RepeatButton x:Name="VerticalDecreaseRepeatButton" Background="Transparent" IsTabStop="False" Opacity="0" Grid.Row="4"/>
                            <Thumb x:Name="VerticalLowerThumb" Panel.ZIndex="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}" c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}" c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" Style="{StaticResource RangeSliderVerticalThumbStyle}" Grid.Row="3"/>
                            <Thumb x:Name="VerticalMiddleThumb" Background="Transparent" IsTabStop="False" Opacity="0" Grid.Row="2"/>
                            <Border Background="{TemplateBinding SelectedAreaBrush}" Panel.ZIndex="1" Grid.Row="2" Opacity="0.5" Margin="0 -10" /> 
                            <Thumb x:Name="VerticalUpperThumb" Panel.ZIndex="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" c1:ClearStyleExtensions.FocusBrush="{TemplateBinding FocusBrush}" c1:ClearStyleExtensions.MouseOverBrush="{TemplateBinding MouseOverBrush}" c1:ClearStyleExtensions.PressedBrush="{TemplateBinding PressedBrush}" Style="{StaticResource RangeSliderVerticalThumbStyle}" Grid.Row="1"/>
                            <RepeatButton x:Name="VerticalIncreaseRepeatButton" Background="Transparent" IsTabStop="False" Opacity="0"/>
                        </Grid>
                        <Border x:Name="FocusVisual" BorderBrush="{TemplateBinding FocusBrush}" BorderThickness="1" IsHitTestVisible="False" Visibility="Collapsed"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>
