modified Controls - added new controls

This commit is contained in:
2026-08-09 18:35:56 +05:00
parent d5dc228ebe
commit 778fc1034b
+143 -7
View File
@@ -33,6 +33,48 @@
</Setter> </Setter>
</Style> </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 ======================= --> <!-- ======================= ComboBox ======================= -->
<Style x:Key="ComboBoxToggleStyle" TargetType="ToggleButton"> <Style x:Key="ComboBoxToggleStyle" TargetType="ToggleButton">
@@ -107,7 +149,7 @@
<Style TargetType="ComboBox"> <Style TargetType="ComboBox">
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" /> <Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}" />
<!-- Правый отступ оставляет место под стрелку --> <!-- Right padding leaves space for the arrow -->
<Setter Property="Padding" Value="9,5,28,5" /> <Setter Property="Padding" Value="9,5,28,5" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
@@ -161,8 +203,14 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="CheckBox"> <ControlTemplate TargetType="CheckBox">
<!-- Прозрачный фон делает щелчок по подписи попаданием в галочку --> <!-- Transparent background makes clicking on the label register as a click on the checkbox.
<StackPanel Orientation="Horizontal" Background="Transparent"> 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" <Border x:Name="Box"
Width="18" Height="18" Width="18" Height="18"
CornerRadius="4" CornerRadius="4"
@@ -179,8 +227,15 @@
StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round"
Visibility="Collapsed" /> Visibility="Collapsed" />
</Border> </Border>
<ContentPresenter Margin="8,0,0,0" VerticalAlignment="Center" /> <ContentPresenter Grid.Column="1" Margin="8,0,0,0"
</StackPanel> VerticalAlignment="Center">
<ContentPresenter.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Box" Property="Background" <Setter TargetName="Box" Property="Background"
@@ -225,7 +280,7 @@
</Setter> </Setter>
</Style> </Style>
<!-- Пройденная часть шкалы: закрашивается акцентом --> <!-- Completed part of the scale: filled with accent color -->
<Style x:Key="SliderDecreaseStyle" TargetType="RepeatButton"> <Style x:Key="SliderDecreaseStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
@@ -284,6 +339,65 @@
</Setter> </Setter>
</Style> </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 ======================= --> <!-- ======================= ScrollBar ======================= -->
<Style x:Key="ScrollBarThumbStyle" TargetType="Thumb"> <Style x:Key="ScrollBarThumbStyle" TargetType="Thumb">
@@ -323,7 +437,7 @@
</Track> </Track>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<!-- У горизонтальной полосы направление трека обычное --> <!-- For the horizontal bar, the track direction is normal -->
<Trigger Property="Orientation" Value="Horizontal"> <Trigger Property="Orientation" Value="Horizontal">
<Setter TargetName="PART_Track" Property="IsDirectionReversed" Value="False" /> <Setter TargetName="PART_Track" Property="IsDirectionReversed" Value="False" />
</Trigger> </Trigger>
@@ -341,4 +455,26 @@
</Style.Triggers> </Style.Triggers>
</Style> </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> </ResourceDictionary>