mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-07 13:11:01 +12:00
278 lines
18 KiB
XML
278 lines
18 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- Copyright (c) 2023-2023 Peter Kirmeier -->
|
|
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:stm="clr-namespace:SystemTrayMenu">
|
|
|
|
<!-- Control Template Referene Example: -->
|
|
<!-- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/scrollbar-styles-and-templates -->
|
|
|
|
<!-- TODO: Check and adjust horizontal scrollbars -->
|
|
<!-- TODO: Take care of disabled scrollbars -->
|
|
<!-- TODO: Implement ColorSliderArrowsAndTrackHover -->
|
|
|
|
<Color x:Key="DisabledForegroundColor">Transparent</Color>
|
|
|
|
<Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="true" />
|
|
<Setter Property="Focusable" Value="false" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type RepeatButton}">
|
|
<Border x:Name="Border" Margin="0" CornerRadius="0" BorderThickness="0">
|
|
<Border.Background>
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="0.0"/>
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="1.0" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
</Border.Background>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal" />
|
|
<VisualState x:Name="MouseOver">
|
|
<Storyboard>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowHoverBackground},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowHoverBackground},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Arrow"
|
|
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowHover},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowClickBackground},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowClickBackground},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Arrow"
|
|
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorArrowClick},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Disabled">
|
|
<Storyboard>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Arrow"
|
|
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledForegroundColor}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<Path x:Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" >
|
|
<Path.Fill>
|
|
<SolidColorBrush Color="{Binding Source={x:Static stm:MenuDefines.ColorArrow},Path=Color}"/>
|
|
</Path.Fill>
|
|
</Path>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<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>
|
|
|
|
<Style x:Key="ScrollBarThumb" 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 x:Name="Border" CornerRadius="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal" />
|
|
<VisualState x:Name="MouseOver">
|
|
<Storyboard>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorSliderHover},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorSliderHover},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorSliderDragging},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
|
|
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
|
|
<EasingColorKeyFrame KeyTime="0" Value="{Binding Source={x:Static stm:MenuDefines.ColorSliderDragging},Path=Color}" />
|
|
</ColorAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Disabled" />
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
|
|
<Grid Background="{x:Static stm:MenuDefines.ColorScrollbarBackground}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition MaxHeight="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
<RowDefinition Height="0.00001*" />
|
|
<RowDefinition MaxHeight="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
</Grid.RowDefinitions>
|
|
<RepeatButton Grid.Row="0"
|
|
Style="{StaticResource ScrollBarLineButton}"
|
|
Height="15"
|
|
Command="ScrollBar.LineUpCommand"
|
|
Content="M 0 4 L 8 4 L 4 0 Z" /> <!-- TODO: Width = Scaling.Scale(15) -->
|
|
<Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="true">
|
|
<Track.DecreaseRepeatButton>
|
|
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
|
|
</Track.DecreaseRepeatButton>
|
|
<Track.Thumb>
|
|
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="0" MinHeight="10">
|
|
<Thumb.BorderBrush>
|
|
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="0.0" />
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="1.0" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
</Thumb.BorderBrush>
|
|
<Thumb.Background>
|
|
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Color="{Binding Source={x:Static stm:MenuDefines.ColorSlider},Path=Color}" Offset="0.0" />
|
|
<GradientStop Color="{Binding Source={x:Static stm:MenuDefines.ColorSlider},Path=Color}" Offset="1.0" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
</Thumb.Background>
|
|
</Thumb>
|
|
</Track.Thumb>
|
|
<Track.IncreaseRepeatButton>
|
|
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
|
|
</Track.IncreaseRepeatButton>
|
|
</Track>
|
|
<RepeatButton Grid.Row="2"
|
|
Style="{StaticResource ScrollBarLineButton}"
|
|
Height="15"
|
|
Command="ScrollBar.LineDownCommand"
|
|
Content="M 0 0 L 4 4 L 8 0 Z" /> <!-- TODO: Width = Scaling.Scale(15) -->
|
|
</Grid>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
|
|
<Grid Background="{x:Static stm:MenuDefines.ColorScrollbarBackground}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition MaxWidth="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
<ColumnDefinition Width="0.00001*" />
|
|
<ColumnDefinition MaxWidth="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
</Grid.ColumnDefinitions>
|
|
<RepeatButton Grid.Column="0"
|
|
Style="{StaticResource ScrollBarLineButton}"
|
|
Width="15"
|
|
Command="ScrollBar.LineLeftCommand"
|
|
Content="M 4 0 L 4 8 L 0 4 Z" /> <!-- TODO: Width = Scaling.Scale(15) -->
|
|
<Track x:Name="PART_Track" Grid.Column="1" IsDirectionReversed="False">
|
|
<Track.DecreaseRepeatButton>
|
|
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
|
|
</Track.DecreaseRepeatButton>
|
|
<Track.Thumb>
|
|
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="0" MinWidth="10">
|
|
<Thumb.BorderBrush>
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="0.0" />
|
|
<GradientStop Color="{TemplateBinding Background}" Offset="1.0" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
</Thumb.BorderBrush>
|
|
<Thumb.Background>
|
|
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Color="{Binding Source={x:Static stm:MenuDefines.ColorSlider},Path=Color}" Offset="0.0" />
|
|
<GradientStop Color="{Binding Source={x:Static stm:MenuDefines.ColorSlider},Path=Color}" Offset="1.0" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
</Thumb.Background>
|
|
</Thumb>
|
|
</Track.Thumb>
|
|
<Track.IncreaseRepeatButton>
|
|
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
|
|
</Track.IncreaseRepeatButton>
|
|
</Track>
|
|
<RepeatButton Grid.Column="2"
|
|
Style="{StaticResource ScrollBarLineButton}"
|
|
Width="15"
|
|
Command="ScrollBar.LineRightCommand"
|
|
Content="M 0 0 L 4 4 L 0 8 Z" /> <!-- TODO: Width = Scaling.Scale(15) -->
|
|
</Grid>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
|
|
<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="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
<Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
|
|
</Trigger>
|
|
<Trigger Property="Orientation" Value="Vertical">
|
|
<Setter Property="Width" Value="15" /> <!-- TODO: Scaling.Scale(15) -->
|
|
<Setter Property="Height" Value="Auto" />
|
|
<Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ResourceDictionary>
|