Files
Shrlalgo.RvKits/Melskin/Controls/RadioButton.xaml

236 lines
14 KiB
Plaintext
Raw Normal View History

2025-08-20 12:10:13 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2026-02-20 15:31:44 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations">
2025-08-20 12:10:13 +08:00
2026-02-20 15:31:44 +08:00
<Style x:Key="EmbossRadioButtonStyle" TargetType="{x:Type RadioButton}">
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-20 12:10:13 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid
2026-02-20 15:31:44 +08:00
x:Name="templateRoot"
2025-08-20 12:10:13 +08:00
Background="Transparent"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-08-20 12:10:13 +08:00
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
2025-09-04 22:39:00 +08:00
<decorations:EmbossBorder
2026-02-20 15:31:44 +08:00
x:Name="radioButtonBorder"
Width="24"
2025-08-20 12:10:13 +08:00
Height="24"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
CornerRadius="8"
2026-02-20 15:31:44 +08:00
Intensity="0.4"
RenderTransformOrigin="0.5,0.5" />
<decorations:SlotBorder
x:Name="markSlot"
2025-10-10 11:19:58 +08:00
Grid.Column="0"
2026-02-20 15:31:44 +08:00
Width="24"
2025-08-20 12:10:13 +08:00
Height="24"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Background}"
CornerRadius="8"
Intensity="0.2"
Visibility="Collapsed">
2025-08-20 12:10:13 +08:00
<Ellipse
2026-02-20 15:31:44 +08:00
x:Name="optionMark"
2026-01-02 17:30:30 +08:00
MinWidth="6"
2026-02-20 15:31:44 +08:00
MinHeight="6"
Margin="1"
Fill="{DynamicResource PrimaryNormalBrush}" />
2025-09-04 22:39:00 +08:00
</decorations:SlotBorder>
2025-08-20 12:10:13 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="contentPresenter"
2025-08-20 12:10:13 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-08-20 12:10:13 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
2025-08-20 12:10:13 +08:00
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="Visibility" Value="Collapsed" />
<Setter TargetName="markSlot" Property="Visibility" Value="Visible" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="HasContent" Value="true">
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource OptionMarkFocusVisual}" />
2025-08-20 12:10:13 +08:00
<Setter Property="Padding" Value="4,-1,0,0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-08-20 12:10:13 +08:00
2026-02-20 15:31:44 +08:00
<Setter TargetName="optionMark" Property="Fill" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="false">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="ShaderEnabled" Value="False" />
<Setter TargetName="radioButtonBorder" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
<Setter TargetName="markSlot" Property="ShaderEnabled" Value="False" />
<Setter TargetName="markSlot" Property="ShaderEnabled" Value="False" />
<Setter TargetName="markSlot" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter TargetName="optionMark" Property="Fill" Value="{DynamicResource PrimaryDisabledBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="RenderTransform">
2025-08-20 12:10:13 +08:00
<Setter.Value>
<ScaleTransform ScaleX="0.9" ScaleY="0.9" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2025-07-11 09:20:23 +08:00
<Style TargetType="{x:Type RadioButton}">
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-12 23:08:54 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="VerticalContentAlignment" Value="Center" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
2025-08-12 23:08:54 +08:00
<Grid
2026-02-20 15:31:44 +08:00
x:Name="templateRoot"
2025-08-12 23:08:54 +08:00
Background="Transparent"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="True">
2025-07-11 09:20:23 +08:00
<Grid.ColumnDefinitions>
2025-08-12 23:08:54 +08:00
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
2025-07-11 09:20:23 +08:00
</Grid.ColumnDefinitions>
2025-08-12 23:08:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="radioButtonBorder"
Width="18"
Height="18"
Margin="3,2"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2025-08-12 23:08:54 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="9"
2026-02-20 15:31:44 +08:00
RenderTransformOrigin="0.5,0.5">
<Grid x:Name="markGrid" Margin="3">
2025-08-12 23:08:54 +08:00
<Ellipse
2026-02-20 15:31:44 +08:00
x:Name="optionMark"
2025-08-12 23:08:54 +08:00
MinWidth="6"
2025-12-23 21:35:54 +08:00
MinHeight="6"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource PrimaryNormalBrush}"
Opacity="0" />
<Ellipse
x:Name="indeterminateMark"
2026-01-02 17:30:30 +08:00
MinWidth="6"
2026-02-20 15:31:44 +08:00
MinHeight="6"
2025-08-12 23:08:54 +08:00
Opacity="0"
Stroke="{DynamicResource PrimaryNormalBrush}"
2026-02-20 15:31:44 +08:00
StrokeThickness="2" />
2025-07-11 09:20:23 +08:00
</Grid>
</Border>
2025-08-12 23:08:54 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="contentPresenter"
2025-08-12 23:08:54 +08:00
Grid.Column="1"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-07-11 09:20:23 +08:00
</Grid>
<ControlTemplate.Triggers>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsChecked" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="optionMark" Property="Opacity" Value="1" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
2026-02-20 15:31:44 +08:00
<Setter TargetName="indeterminateMark" Property="Opacity" Value="1" />
2025-08-20 12:10:13 +08:00
</Trigger>
2025-07-11 09:20:23 +08:00
<Trigger Property="HasContent" Value="true">
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource OptionMarkFocusVisual}" />
2025-08-12 23:08:54 +08:00
<Setter Property="Padding" Value="4,-1,0,0" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
<Setter TargetName="optionMark" Property="Fill" Value="{DynamicResource PrimaryFocusedBrush}" />
<Setter TargetName="indeterminateMark" Property="Stroke" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-12-23 21:35:54 +08:00
2025-07-11 09:20:23 +08:00
<Trigger Property="IsPressed" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="RenderTransform">
2025-07-11 09:20:23 +08:00
<Setter.Value>
2025-08-12 23:08:54 +08:00
<ScaleTransform ScaleX="0.9" ScaleY="0.9" />
2025-07-11 09:20:23 +08:00
</Setter.Value>
</Setter>
</Trigger>
2025-12-23 21:35:54 +08:00
<Trigger Property="IsEnabled" Value="false">
2026-02-20 15:31:44 +08:00
<Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{DynamicResource BorderDisabledBrush}" />
<Setter TargetName="indeterminateMark" Property="Stroke" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="optionMark" Property="Fill" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
2025-12-23 21:35:54 +08:00
</Trigger>
2025-07-11 09:20:23 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2025-08-12 23:08:54 +08:00
2026-02-20 15:31:44 +08:00
<Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}" TargetType="{x:Type RadioButton}">
2025-08-12 23:08:54 +08:00
<Setter Property="Margin" Value="1,3" />
<Setter Property="Padding" Value="4,1" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
2025-08-12 23:08:54 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="border"
2025-08-12 23:08:54 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-02-20 15:31:44 +08:00
CornerRadius="4">
2025-08-12 23:08:54 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="contentPresenter"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-07-11 09:20:23 +08:00
</Border>
<ControlTemplate.Triggers>
2025-08-20 12:10:13 +08:00
<Trigger Property="IsChecked" Value="true">
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
2026-02-20 15:31:44 +08:00
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}" />
2025-07-11 09:20:23 +08:00
<Trigger Property="IsMouseOver" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="false">
2026-02-20 15:31:44 +08:00
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="border" Property="Background" Value="{DynamicResource ControlBackgroundPressedBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
2025-08-20 12:10:13 +08:00
2025-07-11 09:20:23 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>