<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStartupLocation="CenterScreen"
Title="" SizeToContent="WidthAndHeight">
<Window.Resources>
<Style x:Key="scroll_thumb_style" 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="Thumb">
<Rectangle Width="13" Fill="#7D7D7D" RadiusX="5" RadiusY="5">
</Rectangle>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="scroll_background" TargetType="{x:Type RepeatButton}">
<Border Background="Transparent">
</Border>
</ControlTemplate>
<Style TargetType="ScrollBar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid Width="15">
<Border Width="13" HorizontalAlignment="Center" CornerRadius="5" Background="#33555555">
</Border>
<Track HorizontalAlignment="Center" Name="PART_Track" Width="{TemplateBinding Width}" Maximum="{TemplateBinding Maximum}" Minimum="{TemplateBinding Minimum}"
Value="{TemplateBinding Value}" IsDirectionReversed="true">
<Track.DecreaseRepeatButton>
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineUpCommand" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineDownCommand" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource scroll_thumb_style}" >
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<ScrollViewer Height="300">
<Border Width="500" Height="500" Background="LightBlue"></Border>
</ScrollViewer>
</Grid>
</Window>
ListVIew 为ItemsControl,任何属于ItemsControl的控件,DataGrid,ListBox等 ,都默认支持ScrollViewer的,不需要特定去修改它。