<?xml version="1.0" encoding="utf-8"?>
<Application x:Class="ScrollbarStyles.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>

        <!-- 
        Custom ScrollBar Template 
        
        This template is substantially simpler than the standard one. It honors the
        Background and Foreground properties (Background is used to paint the background,
        Foreground is used to paint the thumb and arrows).
        
        -->
        <ControlTemplate TargetType="ScrollBar" x:Key="simpleScrollbarTemplate">
            <Grid x:Name="Root" Background="{TemplateBinding Background}">
                <Grid.Resources>

                    <!-- RepeatButton Templates -->
                    <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
                        <Grid x:Name="Root" Background="Transparent" />
                    </ControlTemplate>

                    <!-- Horizontal Inc/Dec Templates -->
                    <ControlTemplate x:Key="HorizontalIncrementTemplate" TargetType="RepeatButton">
                        <Grid x:Name="Root">
                            <Path Stretch="Uniform" Height="8" Width="4" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z " Fill="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                        </Grid>
                    </ControlTemplate>
                    <ControlTemplate x:Key="HorizontalDecrementTemplate" TargetType="RepeatButton">
                        <Grid x:Name="Root">
                            <Path Stretch="Uniform" Height="8" Width="4" Data="F1 M 110.692,342.252L 110.692,352.682L 104.594,347.467L 110.692,342.252 Z " Fill="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                        </Grid>
                    </ControlTemplate>

                    <!-- Vertical Inc/Dec Templates -->
                    <ControlTemplate x:Key="VerticalIncrementTemplate" TargetType="RepeatButton">
                        <Grid x:Name="Root">
                            <Path Stretch="Uniform" Height="4" Width="8" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z " Fill="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                        </Grid>
                    </ControlTemplate>
                    <ControlTemplate x:Key="VerticalDecrementTemplate" TargetType="RepeatButton">
                        <Grid x:Name="Root">
                            <Path Stretch="Uniform" Height="4" Width="8" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " Fill="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                        </Grid>
                    </ControlTemplate>

                    <!-- Thumb Templates -->
                    <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
                        <Grid x:Name="ThumbVisual" Margin="4,0,4,0">
                            <Rectangle x:Name="Background" RadiusX="4" RadiusY="4" Fill="{TemplateBinding Foreground}" Opacity=".7" />
                        </Grid>
                    </ControlTemplate>
                    <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
                        <Grid x:Name="ThumbVisual" Margin="0,4,0,4">
                            <Rectangle x:Name="Background" RadiusX="4" RadiusY="4" Fill="{TemplateBinding Foreground}" Opacity=".7" />
                        </Grid>
                    </ControlTemplate>
                </Grid.Resources>

                <!-- Horizontal Template -->
                <Grid x:Name="HorizontalRoot" Background="#10000000">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <!-- Repeat Buttons + Thumb -->
                    <RepeatButton x:Name="HorizontalSmallDecrease" Foreground="{TemplateBinding Foreground}" Grid.Column="0" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalDecrementTemplate}" Margin="1" />
                    <RepeatButton x:Name="HorizontalLargeDecrease" Grid.Column="1" Width="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                    <Thumb x:Name="HorizontalThumb" Background="{TemplateBinding Background}" MinWidth="18" Width="18" Grid.Column="2" Template="{StaticResource HorizontalThumbTemplate}" />
                    <RepeatButton x:Name="HorizontalLargeIncrease" Grid.Column="3" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                    <RepeatButton x:Name="HorizontalSmallIncrease" Foreground="{TemplateBinding Foreground}" Grid.Column="4" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalIncrementTemplate}" Margin="1" />
                </Grid>

                <!-- Vertical Template -->
                <Grid x:Name="VerticalRoot" Visibility="Collapsed" Background="#10000000">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <!-- Repeat Buttons + Thumb -->
                    <RepeatButton x:Name="VerticalSmallDecrease" Foreground="{TemplateBinding Foreground}" Grid.Row="0" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalDecrementTemplate}" Margin="1" />
                    <RepeatButton x:Name="VerticalLargeDecrease" Grid.Row="1" Height="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                    <Thumb x:Name="VerticalThumb" Background="{TemplateBinding Background}" MinHeight="18" Height="18" Grid.Row="2" Template="{StaticResource VerticalThumbTemplate}" />
                    <RepeatButton x:Name="VerticalLargeIncrease" Grid.Row="3" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                    <RepeatButton x:Name="VerticalSmallIncrease" Foreground="{TemplateBinding Foreground}" Grid.Row="4" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalIncrementTemplate}" Margin="1" />
                </Grid>
            </Grid>
        </ControlTemplate>

    </Application.Resources>
</Application>