215 lines
14 KiB
XML
215 lines
14 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:HandyControl.Controls">
|
|
|
|
<Style x:Key="ScrollBarBaseRepeatButton" TargetType="RepeatButton">
|
|
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Focusable" Value="false"/>
|
|
<Setter Property="IsTabStop" Value="false"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="RepeatButton">
|
|
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="ScrollBarBaseThumbVertical" TargetType="Thumb">
|
|
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
|
<Setter Property="IsTabStop" Value="false"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Thumb">
|
|
<Rectangle x:Name="rectangle" RadiusX="4" RadiusY="4" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource SecondaryTextBrush}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsDragging" Value="true">
|
|
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource PrimaryTextBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="ScrollBarBaseThumbHorizontal" TargetType="Thumb">
|
|
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
|
<Setter Property="IsTabStop" Value="false"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Thumb">
|
|
<Rectangle x:Name="rectangle" RadiusX="4" RadiusY="4" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource SecondaryTextBrush}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsDragging" Value="true">
|
|
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource PrimaryTextBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="ScrollBarBaseStyle" TargetType="ScrollBar">
|
|
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource ThirdlyTextBrush}"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Focusable" Value="False"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Width" Value="8"/>
|
|
<Setter Property="MinWidth" Value="8"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ScrollBar">
|
|
<Grid x:Name="Bg" SnapsToDevicePixels="true">
|
|
<Border Background="{TemplateBinding Background}" />
|
|
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
|
|
<Track.DecreaseRepeatButton>
|
|
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
|
</Track.DecreaseRepeatButton>
|
|
<Track.IncreaseRepeatButton>
|
|
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
|
</Track.IncreaseRepeatButton>
|
|
<Track.Thumb>
|
|
<Thumb Background="{TemplateBinding Foreground}" Style="{StaticResource ScrollBarBaseThumbVertical}"/>
|
|
</Track.Thumb>
|
|
</Track>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="Orientation" Value="Horizontal">
|
|
<Setter Property="Width" Value="Auto"/>
|
|
<Setter Property="MinWidth" Value="0"/>
|
|
<Setter Property="Height" Value="8"/>
|
|
<Setter Property="MinHeight" Value="8"/>
|
|
<Setter Property="BorderThickness" Value="0,1"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ScrollBar">
|
|
<Grid x:Name="Bg" SnapsToDevicePixels="true">
|
|
<Border Background="{TemplateBinding Background}" />
|
|
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
|
|
<Track.DecreaseRepeatButton>
|
|
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
|
</Track.DecreaseRepeatButton>
|
|
<Track.IncreaseRepeatButton>
|
|
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
|
</Track.IncreaseRepeatButton>
|
|
<Track.Thumb>
|
|
<Thumb Background="{TemplateBinding Foreground}" Style="{StaticResource ScrollBarBaseThumbHorizontal}"/>
|
|
</Track.Thumb>
|
|
</Track>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<ControlTemplate x:Key="ScrollViewerNativeBaseControlTemplate" TargetType="ScrollViewer">
|
|
<ControlTemplate.Resources>
|
|
<Storyboard x:Key="Storyboard1">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
<Storyboard x:Key="Storyboard2">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</ControlTemplate.Resources>
|
|
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.RowSpan="2" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
|
<ScrollBar x:Name="PART_VerticalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
|
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<EventTrigger RoutedEvent="ScrollViewer.MouseEnter">
|
|
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
|
</EventTrigger>
|
|
<EventTrigger RoutedEvent="ScrollViewer.MouseLeave">
|
|
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
|
|
</EventTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="ScrollViewerBaseControlTemplate" TargetType="controls:ScrollViewer">
|
|
<ControlTemplate.Resources>
|
|
<Storyboard x:Key="Storyboard1">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
<Storyboard x:Key="Storyboard2">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
|
<LinearDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</ControlTemplate.Resources>
|
|
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.RowSpan="2" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
|
<ScrollBar x:Name="PART_VerticalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
|
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<EventTrigger RoutedEvent="ScrollViewer.MouseEnter">
|
|
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
|
</EventTrigger>
|
|
<EventTrigger RoutedEvent="ScrollViewer.MouseLeave">
|
|
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
|
|
</EventTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="ScrollViewerNativeBaseStyle" TargetType="ScrollViewer">
|
|
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
|
|
<Setter Property="Focusable" Value="False"/>
|
|
<Setter Property="Template" Value="{StaticResource ScrollViewerNativeBaseControlTemplate}"/>
|
|
</Style>
|
|
|
|
<Style x:Key="ScrollViewerBaseStyle" TargetType="controls:ScrollViewer">
|
|
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
|
|
<Setter Property="Focusable" Value="False"/>
|
|
<Setter Property="Template" Value="{StaticResource ScrollViewerBaseControlTemplate}"/>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |