Files
QuickLook/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Styles.xaml
2024-11-30 17:00:22 +08:00

188 lines
9.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<!-- only for design -->
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ControlButtonStyle"
BasedOn="{StaticResource CaptionButtonStyle}"
TargetType="Button">
<Setter Property="Width" Value="32" />
</Style>
<!-- Postion Slider Control -->
<ControlTemplate x:Key="PositionSliderThumbTemplate" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center"
UseLayoutRounding="True">
<Path x:Name="grip"
Margin="-1,-1"
VerticalAlignment="Center"
Data="M 0,0 A 180,180 180 1 1 1,1 Z"
Fill="Transparent"
Stretch="Fill"
Stroke="{DynamicResource WindowTextForeground}"
StrokeThickness="1"
UseLayoutRounding="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsDragging" Value="true">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource WindowTextForeground}" />
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource WindowTextForeground}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="grip" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource WindowTextForeground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="PositionSliderTemplate" TargetType="{x:Type Slider}">
<Border x:Name="border"
Background="Transparent"
SnapsToDevicePixels="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{TemplateBinding MinHeight}" />
</Grid.RowDefinitions>
<DockPanel LastChildFill="True">
<Border x:Name="PART_SelectionRange"
Height="1"
ClipToBounds="True"
Visibility="Visible">
<Rectangle Margin="10,0,-10,0"
Fill="{DynamicResource WindowTextForeground}"
RadiusX="1"
RadiusY="1" />
</Border>
<Border Height="1"
ClipToBounds="True"
Visibility="Visible">
<Rectangle Margin="10,0,10,0"
Fill="{DynamicResource WindowTextForegroundAlternative}"
RadiusX="1"
RadiusY="1" />
</Border>
</DockPanel>
<Track x:Name="PART_Track">
<Track.Thumb>
<Thumb x:Name="Thumb"
Width="{TemplateBinding MinHeight}"
Height="{TemplateBinding MinHeight}"
VerticalAlignment="Center"
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource PositionSliderThumbTemplate}" />
</Track.Thumb>
</Track>
</Grid>
</Border>
</ControlTemplate>
<Style x:Key="PositionSliderStyle" TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="MinHeight" Value="10" />
<Setter Property="MaxHeight" Value="10" />
<Setter Property="Height" Value="10" />
<Setter Property="Minimum" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="AutoToolTipPlacement" Value="None" />
<Setter Property="IsMoveToPointEnabled" Value="True" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="SelectionStart" Value="0" />
<Setter Property="SelectionEnd" Value="{Binding Path=Value, RelativeSource={RelativeSource Self}}" />
<Setter Property="Template" Value="{StaticResource PositionSliderTemplate}" />
</Style>
<!-- Custom Slider Control -->
<ControlTemplate x:Key="CustomSliderThumbTemplate" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center"
UseLayoutRounding="True">
<Rectangle x:Name="grip"
Width="5"
Height="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}"
Fill="{DynamicResource WindowTextForeground}"
RadiusX="3"
RadiusY="3"
Stretch="Fill"
StrokeThickness="0"
UseLayoutRounding="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsDragging" Value="true">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource WindowTextForeground}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource MainWindowBackground}" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="False">
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource WindowTextForeground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="CustomSliderTemplate" TargetType="{x:Type Slider}">
<Border x:Name="border"
Background="Transparent"
SnapsToDevicePixels="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{TemplateBinding MinHeight}" />
</Grid.RowDefinitions>
<DockPanel LastChildFill="True">
<Border x:Name="PART_SelectionRange"
Height="1"
ClipToBounds="True"
Visibility="Visible">
<Rectangle Margin="4,0,-2,0"
Fill="{DynamicResource WindowTextForeground}"
RadiusX="1"
RadiusY="1" />
</Border>
<Border Height="1"
ClipToBounds="True"
Visibility="Visible">
<Rectangle x:Name="PART_NegativeSelection"
Margin="-2,0,4,0"
Fill="{DynamicResource WindowTextForegroundAlternative}"
RadiusX="1"
RadiusY="1" />
</Border>
</DockPanel>
<Track x:Name="PART_Track">
<Track.Thumb>
<Thumb x:Name="Thumb"
Width="5"
Height="{TemplateBinding MinHeight}"
VerticalAlignment="Center"
Focusable="False"
OverridesDefaultStyle="True"
Template="{StaticResource CustomSliderThumbTemplate}" />
</Track.Thumb>
</Track>
</Grid>
</Border>
</ControlTemplate>
<Style x:Key="CustomSliderStyle" TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="MinHeight" Value="14" />
<Setter Property="MaxHeight" Value="14" />
<Setter Property="Height" Value="14" />
<Setter Property="Minimum" Value="0" />
<Setter Property="IsSnapToTickEnabled" Value="True" />
<Setter Property="SmallChange" Value="0.01" />
<Setter Property="LargeChange" Value="0.01" />
<Setter Property="Focusable" Value="False" />
<Setter Property="TickFrequency" Value="0.01" />
<Setter Property="AutoToolTipPlacement" Value="None" />
<Setter Property="IsMoveToPointEnabled" Value="True" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="SelectionStart" Value="{Binding Path=Minimum, RelativeSource={RelativeSource Self}}" />
<Setter Property="SelectionEnd" Value="{Binding Path=Value, RelativeSource={RelativeSource Self}}" />
<Setter Property="Template" Value="{StaticResource CustomSliderTemplate}" />
</Style>
</ResourceDictionary>