<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">
    <Style x:Key="ScrollBarLineButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Name="Border"
                            Margin="0"
                            BorderThickness="1"
                            BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.BorderBrush}"
                            Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.Background}">
                        <Path x:Name="path"
                              Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                              Width="Auto"
                              Height="Auto"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              Fill="{TemplateBinding Foreground}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsPressed"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.BorderBrush}" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Background}" />
                        </MultiTrigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Opacity"
                                    TargetName="path"
                                    Value="0.5" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="Transparent" />
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="Transparent" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarPageButton"
           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="ScrollBarThumb"
           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="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border x:Name="border"
                            BorderThickness="1"
                            Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.Background}"
                            BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.BorderBrush}" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDragging"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
                            <Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
                            <Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerticalScrollBarLineButton"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="Focusable"
                Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Name="Border"
                            Margin="0"
                            BorderThickness="1"
                            BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.BorderBrush}"
                            Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.Background}">
                        <Path x:Name="path"
                              Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                              Width="Auto"
                              Height="Auto"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              Fill="{TemplateBinding Foreground}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsPressed"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
                        </MultiTrigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Opacity"
                                    TargetName="path"
                                    Value="0.5" />
                            <Setter Property="Background"
                                    TargetName="Border"
                                    Value="Transparent" />
                            <Setter Property="BorderBrush"
                                    TargetName="Border"
                                    Value="Transparent" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerticalScrollBarThumb"
           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="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border x:Name="border"
                            BorderThickness="1"
                            Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.Background}"
                            BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.BorderBrush}" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDragging"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
                            <Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
                            <Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="VerticalScrollBar"
                     TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition MaxHeight="18" />
                <RowDefinition Height="0.00001*" />
                <RowDefinition MaxHeight="18" />
            </Grid.RowDefinitions>
            <Border Grid.RowSpan="3"
                    Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollBar.Background}" />
            <RepeatButton x:Name="repeatButton"
                          Grid.Row="0"
                          Style="{DynamicResource VerticalScrollBarLineButton}"
                          Height="17"
                          Command="ScrollBar.LineUpCommand"
                          Content="M 0 4 L 8 4 L 4 0 Z"
                          VerticalAlignment="Top"
                          Margin="1,1,1,0"
                          Background="{DynamicResource WhiteBrush}" />
            <Track Name="PART_Track"
                   Grid.Row="1"
                   IsDirectionReversed="true"
                   ViewportSize="{TemplateBinding ViewportSize}">
                <Track.Resources>
                    <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
                    <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
                        36
                    </sys:Double>
                </Track.Resources>
                <Track.DecreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBarPageButton}"
                                  Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{DynamicResource VerticalScrollBarThumb}"
                           Margin="1,0,1,0"
                           RenderTransformOrigin="0.5,0.5" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBarPageButton}"
                                  Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton x:Name="repeatButton1"
                          Grid.Row="3"
                          Style="{DynamicResource VerticalScrollBarLineButton}"
                          Height="17"
                          Command="ScrollBar.LineDownCommand"
                          Content="M 0 0 L 4 4 L 8 0 Z"
                          Margin="1,0,1,1"
                          Background="{DynamicResource WhiteBrush}" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="Background"
                        TargetName="repeatButton"
                        Value="{x:Null}" />
                <Setter Property="Background"
                        TargetName="repeatButton1"
                        Value="{x:Null}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="HorizontalScrollBar"
                     TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="18" />
                <ColumnDefinition Width="0.00001*" />
                <ColumnDefinition MaxWidth="18" />
            </Grid.ColumnDefinitions>
            <Border Grid.ColumnSpan="3"
                    Margin="0"
                    Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollBar.Background}" />
            <RepeatButton x:Name="repeatButton"
                          Grid.Column="0"
                          Style="{DynamicResource ScrollBarLineButton}"
                          Width="17"
                          Command="ScrollBar.LineLeftCommand"
                          Content="M 4 0 L 4 8 L 0 4 Z"
                          Margin="1,1,0,1"
                          Background="{DynamicResource WhiteBrush}" />
            <Track Name="PART_Track"
                   Grid.Column="1"
                   IsDirectionReversed="False"
                   Margin="0,1,0,1"
                   ViewportSize="{TemplateBinding ViewportSize}">
                <Track.Resources>
                    <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
                    <sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
                        36
                    </sys:Double>
                </Track.Resources>
                <Track.DecreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBarPageButton}"
                                  Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{DynamicResource ScrollBarThumb}"
                           Margin="0,0,0,0" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBarPageButton}"
                                  Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton x:Name="repeatButton1"
                          Grid.Column="3"
                          Style="{DynamicResource ScrollBarLineButton}"
                          Width="17"
                          Command="ScrollBar.LineRightCommand"
                          Content="M 0 0 L 4 4 L 0 8 Z"
                          Margin="0,1,1,1"
                          Background="{DynamicResource WhiteBrush}" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="Background"
                        TargetName="repeatButton"
                        Value="{x:Null}" />
                <Setter Property="Background"
                        TargetName="repeatButton1"
                        Value="{x:Null}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="ScrollBar">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="Foreground" 
                Value="{DynamicResource BlackBrush}" />
        <Style.Triggers>
            <Trigger Property="Orientation"
                     Value="Horizontal">
                <Setter Property="Width"
                        Value="Auto" />
                <Setter Property="Template"
                        Value="{DynamicResource HorizontalScrollBar}" />
                <Setter Property="Height"
                        Value="17" />
            </Trigger>
            <Trigger Property="Orientation"
                     Value="Vertical">
                <Setter Property="Height"
                        Value="Auto" />
                <Setter Property="Template"
                        Value="{DynamicResource VerticalScrollBar}" />
                <Setter Property="Width"
                        Value="17" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="ScrollBar"
           x:Key="ScrollBarWhite">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="Foreground" 
                Value="{DynamicResource BlackBrush}" />
        <Style.Triggers>
            <Trigger Property="Orientation"
                     Value="Horizontal">
                <Setter Property="Width"
                        Value="Auto" />
                <Setter Property="Template"
                        Value="{DynamicResource HorizontalScrollBar}" />
                <Setter Property="Height"
                        Value="17" />
            </Trigger>
            <Trigger Property="Orientation"
                     Value="Vertical">
                <Setter Property="Height"
                        Value="Auto" />
                <Setter Property="Template"
                        Value="{DynamicResource VerticalScrollBar}" />
                <Setter Property="Width"
                        Value="17" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>