123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Style TargetType="{x:Type ScrollViewer}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- </Style>
- <Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Thumb}">
- <Grid x:Name="Grid">
- <Rectangle
- Width="Auto"
- Height="Auto"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Fill="Transparent" />
- <Border
- x:Name="Rectangle1"
- Width="Auto"
- Height="Auto"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Background="{TemplateBinding Background}"
- CornerRadius="5" />
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="Tag" Value="Horizontal">
- <Setter TargetName="Rectangle1" Property="Width" Value="Auto" />
- <Setter TargetName="Rectangle1" Property="Height" Value="7" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- ScrollBars -->
- <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
- <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
- <Setter Property="Foreground" Value="LightGray" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Width" Value="7" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ScrollBar}">
- <Grid
- x:Name="GridRoot"
- Width="{TemplateBinding Width}"
- Background="{TemplateBinding Background}">
- <Grid.RowDefinitions>
- <RowDefinition Height="0.00001*" />
- </Grid.RowDefinitions>
- <Track
- x:Name="PART_Track"
- Grid.Row="0"
- Focusable="false"
- IsDirectionReversed="true">
- <Track.Thumb>
- <Thumb
- x:Name="Thumb"
- Background="{TemplateBinding Foreground}"
- Style="{DynamicResource ScrollThumbs}" />
- </Track.Thumb>
- <Track.IncreaseRepeatButton>
- <RepeatButton
- x:Name="PageUp"
- Command="ScrollBar.PageDownCommand"
- Focusable="false"
- Opacity="0" />
- </Track.IncreaseRepeatButton>
- <Track.DecreaseRepeatButton>
- <RepeatButton
- x:Name="PageDown"
- Command="ScrollBar.PageUpCommand"
- Focusable="false"
- Opacity="0" />
- </Track.DecreaseRepeatButton>
- </Track>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
- <Setter TargetName="Thumb" Property="Background" Value="{DynamicResource ButtonSelectBrush}" />
- </Trigger>
- <Trigger SourceName="Thumb" Property="IsDragging" Value="true">
- <Setter TargetName="Thumb" Property="Background" Value="{DynamicResource DarkBrush}" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="Thumb" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="Orientation" Value="Horizontal">
- <Setter TargetName="GridRoot" Property="LayoutTransform">
- <Setter.Value>
- <RotateTransform Angle="-90" />
- </Setter.Value>
- </Setter>
- <Setter TargetName="PART_Track" Property="LayoutTransform">
- <Setter.Value>
- <RotateTransform Angle="-90" />
- </Setter.Value>
- </Setter>
- <Setter Property="Width" Value="Auto" />
- <Setter Property="Height" Value="12" />
- <Setter TargetName="Thumb" Property="Tag" Value="Horizontal" />
- <Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
- <Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="AutoHideScrollBarThumb" TargetType="Thumb">
- <Setter Property="OverridesDefaultStyle" Value="True" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Thumb}">
- <Grid>
- <Border Background="#808080" />
- </Grid>
- </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="Opacity" Value="0.2" />
- <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="VerticalScrollBarPageButton2" 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="Opacity" Value="0" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RepeatButton}">
- <Rectangle
- Width="0"
- Height="0"
- Fill="#90000000" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="AutoHideScrollBar" TargetType="{x:Type ScrollBar}">
- <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
- <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Margin" Value="2,1,1,6" />
- <Setter Property="Width" Value="10" />
- <Setter Property="MinWidth" Value="5" />
- <Setter Property="Opacity" Value="0.1" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ScrollBar}">
- <Grid x:Name="Bg" SnapsToDevicePixels="True">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <RepeatButton Grid.Row="0" Style="{StaticResource VerticalScrollBarPageButton2}" />
- <Track
- x:Name="PART_Track"
- Grid.Row="1"
- IsDirectionReversed="True"
- IsEnabled="{TemplateBinding IsMouseOver}">
- <Track.DecreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}" />
- </Track.DecreaseRepeatButton>
- <Track.IncreaseRepeatButton>
- <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}" />
- </Track.IncreaseRepeatButton>
- <Track.Thumb>
- <Thumb Style="{StaticResource AutoHideScrollBarThumb}" />
- </Track.Thumb>
- </Track>
- <RepeatButton Grid.Row="2" Style="{StaticResource VerticalScrollBarPageButton2}" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="AutoHideScrollViewer" TargetType="{x:Type ScrollViewer}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="BorderBrush" Value="LightGray" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Padding" Value="0" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ScrollViewer}">
- <Border
- x:Name="Whole"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- SnapsToDevicePixels="True">
- <Grid Background="{TemplateBinding Background}">
- <ScrollContentPresenter
- Margin="{TemplateBinding Padding}"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- Cursor="{TemplateBinding Cursor}" />
- <ScrollBar
- x:Name="PART_VerticalScrollBar"
- HorizontalAlignment="Right"
- Maximum="{TemplateBinding ScrollableHeight}"
- Orientation="Vertical"
- Style="{StaticResource AutoHideScrollBar}"
- ViewportSize="{TemplateBinding ViewportHeight}"
- Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
- Value="{TemplateBinding VerticalOffset}" />
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <EventTrigger RoutedEvent="ScrollChanged">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetName="PART_VerticalScrollBar"
- Storyboard.TargetProperty="Opacity"
- To="0.8"
- Duration="0:0:1" />
- <DoubleAnimation
- BeginTime="0:0:1"
- Storyboard.TargetName="PART_VerticalScrollBar"
- Storyboard.TargetProperty="Opacity"
- To="0.1"
- Duration="0:0:1" />
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- <EventTrigger RoutedEvent="MouseEnter" SourceName="Whole">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetName="PART_VerticalScrollBar"
- Storyboard.TargetProperty="Opacity"
- To="0.8"
- Duration="0:0:0.7" />
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- <EventTrigger RoutedEvent="MouseLeave" SourceName="Whole">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetName="PART_VerticalScrollBar"
- Storyboard.TargetProperty="Opacity"
- To="0.1"
- Duration="0:0:0.7" />
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|