<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
                    xmlns:dhcc="http://www.dhcc.com.cn">

    <!--ScrollBarLineButton-->
    <Style x:Key="ScrollBarLineButtonVer" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Background" Value="{DynamicResource ScrollBarVerticalButton_Normal_Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarVerticalButton_Normal_BorderBrush}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ScrollBarVerticalButton_Normal_BorderThickness}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border 
          Name="Border"
          Margin="2" 
          CornerRadius="2" 
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="{TemplateBinding BorderThickness}">
                        <Path 
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Fill="{DynamicResource ScrollBarVerticalButton_Normal_Foreground}"
            Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Background" Value="{DynamicResource ScrollBarVerticalButton_Enable_Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarVerticalButton_Enable_BorderBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ScrollBarVerticalButton_Enable_Foreground}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" Value="{DynamicResource ScrollBarVerticalButton_MouseOver_Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarVerticalButton_MouseOver_BorderBrush}" />
                <Setter  Property="BorderThickness" Value="{DynamicResource ScrollBarVerticalButton_MouseOver_BorderThickness}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ScrollBarLineButtonHor" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Background" Value="{DynamicResource ScrollBarHorizontalButton_Normal_Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarHorizontalButton_Normal_BorderBrush}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ScrollBarHorizontalButton_Normal_BorderThickness}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border 
          Name="Border"
          Margin="2" 
          CornerRadius="2" 
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="{TemplateBinding BorderThickness}">
                        <Path 
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Fill="{DynamicResource ScrollBarHorizontalButton_Normal_Foreground}"
            Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Background" Value="{DynamicResource ScrollBarHorizontalButton_Enable_Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarHorizontalButton_Enable_BorderBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ScrollBarHorizontalButton_Enable_Foreground}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" Value="{DynamicResource ScrollBarHorizontalButton_MouseOver_Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ScrollBarHorizontalButton_MouseOver_BorderBrush}" />
                <Setter  Property="BorderThickness" Value="{DynamicResource ScrollBarHorizontalButton_MouseOver_BorderThickness}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <!--RepeatButton-->
    <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>
<!--ScrollBarThumb-->
    <Style x:Key="ScrollBarThumbVer" 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 
          CornerRadius="2" 
                        x:Name="Border"
          Background="{DynamicResource ScrollBarVerticalScrollButton_Normal_Background}"
          BorderBrush="{DynamicResource ScrollBarVerticalScrollButton_Normal_BorderBrush}"
          BorderThickness="{DynamicResource ScrollBarVerticalScrollButton_Normal_BorderThickness}" >
                        <Canvas Width="8"
                                Height="8"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center">
                            <Canvas.Resources>
                                <Style TargetType="{x:Type Line}">
                                    <Setter Property="Stroke" Value="{DynamicResource ScrollBarVerticalScrollButton_Normal_Foreground}"/>
                                    <Setter Property="StrokeThickness" Value="1"/>
                                </Style>
                            </Canvas.Resources>
                            <Line X1="0" Y1="0" X2="8" Y2="0" />
                            <Line X1="0" Y1="4" X2="8" Y2="4"/>
                            <Line X1="0" Y1="8" X2="8" Y2="8"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ScrollBarVerticalScrollButton_Enable_Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ScrollBarVerticalScrollButton_Enable_BorderBrush}" />
                            <Setter Property="Foreground" Value="{DynamicResource ScrollBarVerticalScrollButton_Enable_Foreground}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ScrollBarVerticalScrollButton_MouseOver_Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ScrollBarVerticalScrollButton_MouseOver_BorderBrush}" />
                            <Setter TargetName="Border" Property="BorderThickness" Value="{DynamicResource ScrollBarVerticalScrollButton_MouseOver_BorderThickness}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarThumbHor" 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 
          CornerRadius="2" 
                        x:Name="Border"
          Background="{DynamicResource ScrollBarHorizontalScrollButton_Normal_Background}"
          BorderBrush="{DynamicResource ScrollBarHorizontalScrollButton_Normal_BorderBrush}"
          BorderThickness="1" >
                        <Canvas Width="8"
                                Height="8"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center">
                            <Canvas.Resources>
                                <Style TargetType="{x:Type Line}">
                                    <Setter Property="Stroke" Value="{DynamicResource ScrollBarHorizontalScrollButton_Normal_Foreground}"/>
                                    <Setter Property="StrokeThickness" Value="1"/>
                                </Style>
                            </Canvas.Resources>
                            <Line X1="0" Y1="0" X2="0" Y2="8" />
                            <Line X1="4" Y1="0" X2="4" Y2="8"/>
                            <Line X1="8" Y1="0" X2="8" Y2="8"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ScrollBarHorizontalScrollButton_Enable_Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ScrollBarHorizontalScrollButton_Enable_BorderBrush}" />
                            <Setter Property="Foreground" Value="{DynamicResource ScrollBarHorizontalScrollButton_Enable_Foreground}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ScrollBarHorizontalScrollButton_MouseOver_Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ScrollBarHorizontalScrollButton_MouseOver_BorderBrush}" />
                            <Setter TargetName="Border" Property="BorderThickness" Value="{DynamicResource ScrollBarHorizontalScrollButton_MouseOver_BorderThickness}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--VerticalScrollBar-->
    <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"
      CornerRadius="2" 
      Background="{DynamicResource ScrollBarVertical_Normal_Background}" 
      BorderBrush="{DynamicResource ScrollBarVertical_Normal_BorderBrush}"
      BorderThickness="{DynamicResource ScrollBarVertical_Normal_BorderThickness}"/>
            <RepeatButton 
      Grid.Row="0"                           
      Style="{StaticResource ScrollBarLineButtonVer}"
      Height="18"
      Command="ScrollBar.LineUpCommand"
      Content="M 0 4 L 8 4 L 4 0 Z" />
            <Track 
      Name="PART_Track"
      Grid.Row="1"
      IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb 
          Style="{StaticResource ScrollBarThumbVer}" 
          Margin="2,0,2,0"  />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton 
      Grid.Row="3" 
      Style="{StaticResource ScrollBarLineButtonVer}"
      Height="18"
      Command="ScrollBar.LineDownCommand"
      Content="M 0 0 L 4 4 L 8 0 Z"/>
        </Grid>
    </ControlTemplate>
<!--HorizontalScrollBar-->
    <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"
              CornerRadius="2" 
              Background="{DynamicResource ScrollBarHorizontal_Normal_Background}"
              BorderBrush="{DynamicResource ScrollBarHorizontal_Normal_BorderBrush}"
              BorderThickness="{DynamicResource ScrollBarHorizontal_Normal_BorderThickness}"/>
            <RepeatButton 
      Grid.Column="0"                           
      Style="{StaticResource ScrollBarLineButtonHor}"
      Width="18"
      Command="ScrollBar.LineLeftCommand"
      Content="M 4 0 L 4 8 L 0 4 Z" />
            <Track 
      Name="PART_Track"
      Grid.Column="1"
      IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb 
          Style="{StaticResource ScrollBarThumbHor}" 
          Margin="0,2,0,2"  />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton 
      Grid.Column="3" 
      Style="{StaticResource ScrollBarLineButtonHor}"
      Width="18"
      Command="ScrollBar.LineRightCommand"
      Content="M 0 0 L 4 4 L 0 8 Z"/>
        </Grid>
    </ControlTemplate>
<!--BaseScrollBar-->
    <Style TargetType="{x:Type ScrollBar}"   BasedOn="{StaticResource {x:Type ScrollBar}}">
        <Setter Property="dhcc:FocusManager.OnlyMouseControlHandled" Value="{x:Static dhcc:ControlHelper.EmptyMouseHandled}" />
        <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="18" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="18"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
        </Style.Triggers>
    </Style>


</ResourceDictionary>