<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <SolidColorBrush x:Key="ScrollBar_BD" Color="#FF243664" />
    <SolidColorBrush x:Key="ScrollBar_BG" Color="#FF3d8d73" />

    <SolidColorBrush x:Key="ScrollBar_InnerHighlight" Color="#FF9FCDED" />
    <SolidColorBrush x:Key="ScrollBar_InnerShadow" Color="#FF003A62" />
    <SolidColorBrush x:Key="ScrollBar_BG_MouseOver" Color="#FF00ae72" />

    <SolidColorBrush x:Key="ScrollBar_ArrowBG" Color="White" />
    <SolidColorBrush x:Key="ScrollBar_BD_Unable" Color="#FF868686" />
    <LinearGradientBrush x:Key="ScrollBar_BG_Unable" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Offset="0" Color="#FFB1B1B1" />
        <GradientStop Offset="1" Color="#FFDADADA" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ScrollBar_InnerHighlight_Unable" Color="#FFD8D8D8" />
    <SolidColorBrush x:Key="ScrollBar_InnerShadow_Unable" Color="#FF6C6C6C" />

    <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="BorderBrush" Value="{DynamicResource ScrollBar_BD}" />
        <Setter Property="Background" Value="{DynamicResource ScrollBar_BG}" />
        <Setter Property="Border.CornerRadius" Value="3" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="OnMouseOver">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,1,0"
                                    KeyTime="0:0:0.2"
                                    Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="OnMouseOut">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,0,1"
                                    KeyTime="0:0:0.2"
                                    Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="BG" Cursor="Hand">
                        <Border
                            x:Name="OuterBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1"
                            CornerRadius="{TemplateBinding Border.CornerRadius}">
                            <Border
                                x:Name="InnerBD_Highlight"
                                BorderBrush="{DynamicResource ScrollBar_InnerHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2">
                                <Border
                                    x:Name="InnerBD_Shadow"
                                    BorderBrush="{DynamicResource ScrollBar_InnerShadow}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                            </Border>
                        </Border>
                        <Border
                            x:Name="HighLight"
                            Margin="2"
                            Background="{DynamicResource ScrollBar_BG_MouseOver}"
                            CornerRadius="2"
                            Opacity="0" />
                        <Path
                            x:Name="path"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                            Fill="{DynamicResource ScrollBar_ArrowBG}">
                            <Path.Effect>
                                <DropShadowEffect BlurRadius="0" ShadowDepth="1" />
                            </Path.Effect>
                        </Path>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="OnMouseOut_BeginStoryboard" Storyboard="{StaticResource OnMouseOut}" />
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OnMouseOver}" />
                            </Trigger.EnterActions>
                            <Setter TargetName="path" Property="Fill" Value="#CCFFFFFF" />
                            <Setter TargetName="path" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect BlurRadius="0" ShadowDepth="2" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="HighLight" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource ScrollBar_BG_Unable}" />
                            <Setter TargetName="InnerBD_Highlight" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerHighlight_Unable}" />
                            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource ScrollBar_BD_Unable}" />
                            <Setter TargetName="InnerBD_Shadow" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerShadow_Unable}" />
                            <Setter TargetName="path" Property="Fill" Value="#FF999999" />
                            <Setter TargetName="path" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect
                                        BlurRadius="0"
                                        Opacity="0"
                                        ShadowDepth="1" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Fill="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Fill="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarVerticalThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="BorderBrush" Value="{DynamicResource ScrollBar_BD}" />
        <Setter Property="Background" Value="{DynamicResource ScrollBar_BG}" />
        <Setter Property="Border.CornerRadius" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="OnMouseOver">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,1,0"
                                    KeyTime="0:0:0.2"
                                    Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="OnMouseOut">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,0,1"
                                    KeyTime="0:0:0.2"
                                    Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="BG" Cursor="Hand">
                        <Border
                            x:Name="OuterBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1"
                            CornerRadius="{TemplateBinding Border.CornerRadius}">
                            <Border
                                x:Name="InnerBD_Highlight"
                                BorderBrush="{DynamicResource ScrollBar_InnerHighlight}"
                                BorderThickness="1,1,0,0">
                                <Border
                                    x:Name="InnerBD_Shadow"
                                    BorderBrush="{DynamicResource ScrollBar_InnerShadow}"
                                    BorderThickness="0,0,1,1" />
                            </Border>
                        </Border>
                        <Border
                            x:Name="HighLight"
                            Margin="2"
                            Background="{DynamicResource ScrollBar_BG_MouseOver}"
                            CornerRadius="2"
                            Opacity="0" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="OnMouseOut_BeginStoryboard" Storyboard="{StaticResource OnMouseOut}" />
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OnMouseOver}" />
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource ScrollBar_BG_Unable}" />
                            <Setter TargetName="InnerBD_Highlight" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerHighlight_Unable}" />
                            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource ScrollBar_BD_Unable}" />
                            <Setter TargetName="InnerBD_Shadow" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerShadow_Unable}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarHorizontalThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="BorderBrush" Value="{DynamicResource ScrollBar_BD}" />
        <Setter Property="Background" Value="{DynamicResource ScrollBar_BG}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="OnMouseOver">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,1,0"
                                    KeyTime="0:0:0.2"
                                    Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="OnMouseOut">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="HighLight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                <SplineDoubleKeyFrame
                                    KeySpline="0,0,0,1"
                                    KeyTime="0:0:0.2"
                                    Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="BG" Cursor="Hand">
                        <Border
                            x:Name="OuterBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1"
                            CornerRadius="{TemplateBinding Border.CornerRadius}">
                            <Border
                                x:Name="InnerBD_Highlight"
                                BorderBrush="{DynamicResource ScrollBar_InnerHighlight}"
                                BorderThickness="1,1,0,0">
                                <Border
                                    x:Name="InnerBD_Shadow"
                                    BorderBrush="{DynamicResource ScrollBar_InnerShadow}"
                                    BorderThickness="0,0,1,1" />
                            </Border>
                        </Border>
                        <Border
                            x:Name="HighLight"
                            Margin="1"
                            Background="{DynamicResource ScrollBar_BG_MouseOver}"
                            Opacity="0" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="OnMouseOut_BeginStoryboard" Storyboard="{StaticResource OnMouseOut}" />
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OnMouseOver}" />
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource ScrollBar_BG_Unable}" />
                            <Setter TargetName="InnerBD_Highlight" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerHighlight_Unable}" />
                            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource ScrollBar_BD_Unable}" />
                            <Setter TargetName="InnerBD_Shadow" Property="BorderBrush" Value="{DynamicResource ScrollBar_InnerShadow_Unable}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition MaxHeight="22" />
                <RowDefinition Height="0.00001*" />
                <RowDefinition MaxHeight="22" />
            </Grid.RowDefinitions>
            <RepeatButton
                Grid.Row="0"
                Height="21"
                VerticalAlignment="Top"
                Command="ScrollBar.LineUpCommand"
                Content="M 0 4 L 8 4 L 4 0 Z"
                Style="{StaticResource ScrollBarLineButton}" />
            <Track
                Name="PART_Track"
                Grid.Row="1"
                Height="{TemplateBinding Height}"
                IsDirectionReversed="true"
                Maximum="{TemplateBinding Maximum}"
                Minimum="{TemplateBinding Minimum}"
                Value="{TemplateBinding Value}">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource VerticalScrollBarPageButton}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource ScrollBarVerticalThumb}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource VerticalScrollBarPageButton}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
                Grid.Row="3"
                Height="21"
                VerticalAlignment="Bottom"
                Command="ScrollBar.LineDownCommand"
                Content="M 0 0 L 4 4 L 8 0 Z"
                Style="{StaticResource ScrollBarLineButton}" />
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="22" />
                <ColumnDefinition Width="0.00001*" />
                <ColumnDefinition MaxWidth="22" />
            </Grid.ColumnDefinitions>
            <RepeatButton
                Grid.Column="0"
                Width="21"
                HorizontalAlignment="Left"
                Command="ScrollBar.LineLeftCommand"
                Content="M 4 0 L 4 8 L 0 4 Z"
                Style="{StaticResource ScrollBarLineButton}" />
            <Track
                Name="PART_Track"
                Grid.Column="1"
                Width="{TemplateBinding Width}"
                IsDirectionReversed="False"
                Maximum="{TemplateBinding Maximum}"
                Minimum="{TemplateBinding Minimum}"
                Value="{TemplateBinding Value}">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageLeftCommand" Style="{StaticResource HorizontalScrollBarPageButton}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource ScrollBarHorizontalThumb}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Command="ScrollBar.PageRightCommand" Style="{StaticResource HorizontalScrollBarPageButton}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
                Grid.Column="3"
                Width="21"
                HorizontalAlignment="Right"
                Command="ScrollBar.LineRightCommand"
                Content="M 0 0 L 4 4 L 0 8 Z"
                Style="{StaticResource ScrollBarLineButton}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="Height" Value="20" />
                <Setter Property="Margin" Value="0,1" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="20" />
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Margin" Value="1,0" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Rectangle
                            x:Name="Corner"
                            Grid.Row="1"
                            Grid.Column="1"
                            Fill="{x:Null}" />
                        <ScrollContentPresenter
                            x:Name="PART_ScrollContentPresenter"
                            Grid.Row="0"
                            Grid.Column="0"
                            Margin="{TemplateBinding Padding}"
                            CanContentScroll="{TemplateBinding CanContentScroll}"
                            CanHorizontallyScroll="False"
                            CanVerticallyScroll="False"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}" />
                        <ScrollBar
                            x:Name="PART_VerticalScrollBar"
                            Grid.Row="0"
                            Grid.Column="1"
                            AutomationProperties.AutomationId="VerticalScrollBar"
                            Cursor="Arrow"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            Minimum="0"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                            Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <ScrollBar
                            x:Name="PART_HorizontalScrollBar"
                            Grid.Row="1"
                            Grid.Column="0"
                            AutomationProperties.AutomationId="HorizontalScrollBar"
                            Cursor="Arrow"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            Minimum="0"
                            Orientation="Horizontal"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                            Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>