Files
alex 5e11b16758 changed settings saving (#3)
Reviewed-on: #3
Co-authored-by: Aleksandr Neychev <alexnejchev73@gmail.com>
2026-08-12 17:15:12 +00:00

546 lines
27 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- ======================= GroupBox ======================= -->
<Style TargetType="GroupBox">
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0,0,0,12" />
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentPresenter ContentSource="Header"
Margin="2,0,0,6"
TextBlock.FontWeight="SemiBold" />
<Border Grid.Row="1"
Background="{DynamicResource Theme.Surface}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="6"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= Button ======================= -->
<Style TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="Padding" Value="12,5" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Border"
Background="{DynamicResource Theme.ControlBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.ControlHoverBackground}" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="Border" Property="BorderBrush"
Value="{DynamicResource Theme.Accent}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.SelectionBackground}" />
<Setter TargetName="Border" Property="BorderBrush"
Value="{DynamicResource Theme.Accent}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= ComboBox ======================= -->
<Style x:Key="ComboBoxToggleStyle" TargetType="ToggleButton">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="ClickMode" Value="Press" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="Border"
Background="{DynamicResource Theme.ControlBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="4"
SnapsToDevicePixels="True">
<Path x:Name="Arrow"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,10,0"
Data="M0,0 L4,4 L8,0"
Stroke="{DynamicResource Theme.SecondaryForeground}"
StrokeThickness="1.4" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.ControlHoverBackground}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Border" Property="BorderBrush"
Value="{DynamicResource Theme.Accent}" />
<Setter TargetName="Arrow" Property="Stroke"
Value="{DynamicResource Theme.Accent}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="Padding" Value="8,5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="Border"
Background="Transparent"
CornerRadius="3"
Margin="3,1"
Padding="{TemplateBinding Padding}">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.SelectionBackground}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.SelectionBackground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ComboBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<!-- Right padding leaves space for the arrow -->
<Setter Property="Padding" Value="9,5,28,5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Style="{StaticResource ComboBoxToggleStyle}"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay,
RelativeSource={RelativeSource TemplatedParent}}" />
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
HorizontalAlignment="Left" VerticalAlignment="Center"
IsHitTestVisible="False" />
<Popup x:Name="PART_Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade">
<Border Background="{DynamicResource Theme.PopupBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="4"
Margin="0,2,0,0"
MinWidth="{Binding ActualWidth,
RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<ScrollViewer>
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= CheckBox ======================= -->
<Style TargetType="CheckBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="MinHeight" Value="24" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<!-- Transparent background makes clicking on the label register as a click on the checkbox.
The label lies in a column of limited width: long translations wrap by words
instead of being cut off -->
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="Box"
Width="18" Height="18"
CornerRadius="4"
VerticalAlignment="Center"
Background="{DynamicResource Theme.ControlBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
SnapsToDevicePixels="True">
<Path x:Name="Check"
HorizontalAlignment="Center" VerticalAlignment="Center"
Data="M0,4 L3.5,7.5 L9.5,0.5"
Stroke="White"
StrokeThickness="1.8"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"
Visibility="Collapsed" />
</Border>
<ContentPresenter Grid.Column="1" Margin="8,0,0,0"
VerticalAlignment="Center">
<ContentPresenter.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Box" Property="Background"
Value="{DynamicResource Theme.ControlHoverBackground}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Box" Property="Background"
Value="{DynamicResource Theme.Accent}" />
<Setter TargetName="Box" Property="BorderBrush"
Value="{DynamicResource Theme.Accent}" />
<Setter TargetName="Check" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= Slider ======================= -->
<Style x:Key="SliderThumbStyle" TargetType="Thumb">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Width" Value="14" />
<Setter Property="Height" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse x:Name="Circle"
Fill="{DynamicResource Theme.Accent}"
Stroke="{DynamicResource Theme.ControlBackground}"
StrokeThickness="2" />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Circle" Property="StrokeThickness" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Completed part of the scale: filled with accent color -->
<Style x:Key="SliderDecreaseStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Height="4" CornerRadius="2"
VerticalAlignment="Center"
Background="{DynamicResource Theme.Accent}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TransparentRepeatStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Slider">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="IsSnapToTickEnabled" Value="True" />
<Setter Property="MinHeight" Value="24" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Grid Background="Transparent">
<Border Height="4" CornerRadius="2"
VerticalAlignment="Center"
Background="{DynamicResource Theme.SliderTrack}" />
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="Slider.DecreaseLarge"
Style="{StaticResource SliderDecreaseStyle}" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource SliderThumbStyle}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="Slider.IncreaseLarge"
Style="{StaticResource TransparentRepeatStyle}" />
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</Style.Triggers>
</Style>
<!-- ======================= ProgressBar ======================= -->
<Style TargetType="ProgressBar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<Border Background="{DynamicResource Theme.SliderTrack}"
CornerRadius="2"
SnapsToDevicePixels="True">
<Grid x:Name="PART_Track" ClipToBounds="True">
<Border x:Name="PART_Indicator"
HorizontalAlignment="Left"
Background="{DynamicResource Theme.Accent}"
CornerRadius="2"
RenderTransformOrigin="0,0">
<Border.RenderTransform>
<ScaleTransform ScaleX="1" />
</Border.RenderTransform>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!-- The share downloaded is unknown: the bar fills over and over instead -->
<Trigger Property="IsIndeterminate" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="Running">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="PART_Indicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
From="0" To="1"
Duration="0:0:1.2"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="Running" />
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= Hyperlink ======================= -->
<!-- The underline is left for the pointer: a line under every link is noise -->
<Style TargetType="Hyperlink">
<Setter Property="Foreground" Value="{DynamicResource Theme.Accent}" />
<Setter Property="TextDecorations" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>
<!-- ======================= ScrollBar ======================= -->
<Style x:Key="ScrollBarThumbStyle" TargetType="Thumb">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border Background="{DynamicResource Theme.ScrollBarThumb}"
CornerRadius="3" Margin="3" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Width" Value="12" />
<Setter Property="MinWidth" Value="12" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid Background="{TemplateBinding Background}">
<Track x:Name="PART_Track"
Orientation="{TemplateBinding Orientation}"
IsDirectionReversed="True">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand"
Style="{StaticResource TransparentRepeatStyle}" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumbStyle}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand"
Style="{StaticResource TransparentRepeatStyle}" />
</Track.IncreaseRepeatButton>
</Track>
</Grid>
<ControlTemplate.Triggers>
<!-- For the horizontal bar, the track direction is normal -->
<Trigger Property="Orientation" Value="Horizontal">
<Setter TargetName="PART_Track" Property="IsDirectionReversed" Value="False" />
</Trigger>
</ControlTemplate.Triggers>
</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="12" />
<Setter Property="MinHeight" Value="12" />
</Trigger>
</Style.Triggers>
</Style>
<!-- ======================= Tray menu ======================= -->
<Style TargetType="ContextMenu">
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="HasDropShadow" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<Border Background="{DynamicResource Theme.PopupBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="3"
SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="MenuItem">
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="Padding" Value="12,6" />
<Setter Property="MinWidth" Value="160" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Border"
Background="Transparent"
CornerRadius="3"
Padding="{TemplateBinding Padding}">
<ContentPresenter ContentSource="Header" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Border" Property="Background"
Value="{DynamicResource Theme.SelectionBackground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
<Setter Property="Height" Value="1" />
<Setter Property="Margin" Value="8,4" />
<Setter Property="Background" Value="{DynamicResource Theme.ControlBorder}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Separator">
<Border Background="{TemplateBinding Background}"
HorizontalAlignment="Stretch"
SnapsToDevicePixels="True" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ======================= ToolTip ======================= -->
<Style TargetType="ToolTip">
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<Setter Property="MaxWidth" Value="360" />
<Setter Property="HasDropShadow" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<Border Background="{DynamicResource Theme.PopupBackground}"
BorderBrush="{DynamicResource Theme.ControlBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="10,6"
SnapsToDevicePixels="True">
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>