Files
ShrlAlgoToolkit/NeoUI/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-01-02 17:30:30 +08:00
xmlns:decorations="clr-namespace:VariaStudio.Controls.Decorations"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2025-08-20 12:10:13 +08:00
2026-01-02 17:30:30 +08:00
<Style TargetType="{x:Type RadioButton}" x:Key="EmbossRadioButtonStyle">
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
Background="Transparent"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="True"
x:Name="templateRoot">
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-01-02 17:30:30 +08:00
Background="{TemplateBinding Background}"
CornerRadius="8"
2025-08-20 12:10:13 +08:00
Height="24"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Intensity="0.4"
RenderTransformOrigin="0.5,0.5"
2025-08-20 12:10:13 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-01-02 17:30:30 +08:00
Width="24"
x:Name="radioButtonBorder" />
<decorations:SlotBorder
2025-08-20 12:10:13 +08:00
Background="{TemplateBinding Background}"
CornerRadius="8"
2025-10-10 11:19:58 +08:00
Grid.Column="0"
2025-08-20 12:10:13 +08:00
Height="24"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2025-12-23 21:35:54 +08:00
Intensity="0.2"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="Collapsed"
Width="24"
x:Name="markSlot">
2025-08-20 12:10:13 +08:00
<Ellipse
2026-01-02 17:30:30 +08:00
Fill="{DynamicResource PrimaryNormalBrush}"
2025-12-23 21:35:54 +08:00
Margin="1"
2026-01-02 17:30:30 +08:00
MinHeight="6"
MinWidth="6"
x:Name="optionMark" />
2025-09-04 22:39:00 +08:00
</decorations:SlotBorder>
2025-08-20 12:10:13 +08:00
<ContentPresenter
2026-01-02 17:30:30 +08:00
Focusable="False"
2025-08-20 12:10:13 +08:00
Grid.Column="1"
2025-12-23 21:35:54 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
2025-12-23 21:35:54 +08:00
RecognizesAccessKey="True"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
2025-08-20 12:10:13 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource PrimaryNormalBrush}" />
2025-08-20 12:10:13 +08:00
2026-01-02 17:30:30 +08:00
<Setter Property="Visibility" TargetName="radioButtonBorder" Value="Collapsed" />
<Setter Property="Visibility" TargetName="markSlot" 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-01-02 17:30:30 +08:00
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-08-20 12:10:13 +08:00
2026-01-02 17:30:30 +08:00
<Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource PrimaryFocusedBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="false">
2026-01-02 17:30:30 +08:00
<Setter Property="ShaderEnabled" TargetName="radioButtonBorder" Value="False" />
<Setter Property="Background" TargetName="radioButtonBorder" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
<Setter Property="ShaderEnabled" TargetName="markSlot" Value="False" />
<Setter Property="ShaderEnabled" TargetName="markSlot" Value="False" />
<Setter Property="Background" TargetName="markSlot" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
<Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource PrimaryDisabledBrush}" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="RenderTransform" TargetName="radioButtonBorder">
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
Background="Transparent"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="True"
x:Name="templateRoot">
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
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="9"
2026-01-02 17:30:30 +08:00
Height="18"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="3,2"
RenderTransformOrigin="0.5,0.5"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Width="18"
x:Name="radioButtonBorder">
<Grid Margin="3" x:Name="markGrid">
2025-08-12 23:08:54 +08:00
<Ellipse
2025-12-23 21:35:54 +08:00
Fill="{DynamicResource PrimaryNormalBrush}"
2026-01-02 17:30:30 +08:00
MinHeight="6"
2025-08-12 23:08:54 +08:00
MinWidth="6"
2026-01-02 17:30:30 +08:00
Opacity="0"
x:Name="optionMark" />
<Ellipse
2025-12-23 21:35:54 +08:00
MinHeight="6"
2026-01-02 17:30:30 +08:00
MinWidth="6"
2025-08-12 23:08:54 +08:00
Opacity="0"
Stroke="{DynamicResource PrimaryNormalBrush}"
2026-01-02 17:30:30 +08:00
StrokeThickness="2"
x:Name="indeterminateMark" />
2025-07-11 09:20:23 +08:00
</Grid>
</Border>
2025-08-12 23:08:54 +08:00
<ContentPresenter
2026-01-02 17:30:30 +08:00
Focusable="False"
2025-08-12 23:08:54 +08:00
Grid.Column="1"
2025-12-23 21:35:54 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
Margin="{TemplateBinding Padding}"
2025-12-23 21:35:54 +08:00
RecognizesAccessKey="True"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
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-01-02 17:30:30 +08:00
<Setter Property="Opacity" TargetName="optionMark" Value="1" />
2025-08-20 12:10:13 +08:00
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
2026-01-02 17:30:30 +08:00
<Setter Property="Opacity" TargetName="indeterminateMark" 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-01-02 17:30:30 +08:00
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{DynamicResource PrimaryFocusedBrush}" />
<Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource PrimaryFocusedBrush}" />
<Setter Property="Stroke" TargetName="indeterminateMark" 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-01-02 17:30:30 +08:00
<Setter Property="RenderTransform" TargetName="radioButtonBorder">
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-01-02 17:30:30 +08:00
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{DynamicResource BorderDisabledBrush}" />
<Setter Property="Stroke" TargetName="indeterminateMark" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter Property="Fill" TargetName="optionMark" Value="{DynamicResource PrimaryDisabledBrush}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" 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-01-02 17:30:30 +08:00
<Style TargetType="{x:Type RadioButton}" x:Key="{x:Static ToolBar.RadioButtonStyleKey}">
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
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2026-01-02 17:30:30 +08:00
CornerRadius="4"
x:Name="border">
2025-08-12 23:08:54 +08:00
<ContentPresenter
2025-12-23 21:35:54 +08:00
Focusable="False"
2026-01-02 17:30:30 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
2025-12-23 21:35:54 +08:00
RecognizesAccessKey="True"
2026-01-02 17:30:30 +08:00
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
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-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="border" 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-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundHoverBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="false">
2026-01-02 17:30:30 +08:00
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
2026-01-02 17:30:30 +08:00
<Setter Property="Background" TargetName="border" 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>