|
|
|
@ -1,4 +1,11 @@ |
|
|
|
<Styles xmlns="https://github.com/avaloniaui"> |
|
|
|
<Design.PreviewWith> |
|
|
|
<Border Padding="20"> |
|
|
|
<StackPanel Spacing="10"> |
|
|
|
<RadioButton /> |
|
|
|
</StackPanel> |
|
|
|
</Border> |
|
|
|
</Design.PreviewWith> |
|
|
|
<Style Selector="RadioButton"> |
|
|
|
<Setter Property="Background" Value="{DynamicResource RadioButtonBackground}" /> |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource RadioButtonForeground}" /> |
|
|
|
@ -15,20 +22,53 @@ |
|
|
|
<ControlTemplate TargetType="RadioButton"> |
|
|
|
<Border Name="RootBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{DynamicResource ControlCornerRadius}"> |
|
|
|
<Grid ColumnDefinitions="20,*"> |
|
|
|
<Grid VerticalAlignment="Top" Height="32"> |
|
|
|
<Ellipse Name="OuterEllipse" Width="20" Height="20" UseLayoutRounding="False" Stroke="{DynamicResource RadioButtonOuterEllipseStroke}" Fill="{StaticResource RadioButtonOuterEllipseFill}" |
|
|
|
StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" /> |
|
|
|
<Ellipse Name="CheckOuterEllipse" Width="20" Height="20" UseLayoutRounding="False" Stroke="{DynamicResource RadioButtonOuterEllipseCheckedStroke}" Fill="{DynamicResource RadioButtonOuterEllipseCheckedFill}" Opacity="0" |
|
|
|
StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" /> |
|
|
|
<Ellipse Name="CheckGlyph" Width="8" Height="8" UseLayoutRounding="False" Opacity="0" Fill="{DynamicResource RadioButtonCheckGlyphFill}" Stroke="{DynamicResource RadioButtonCheckGlyphStroke}" /> |
|
|
|
<Grid VerticalAlignment="Top" |
|
|
|
Height="32"> |
|
|
|
|
|
|
|
<Ellipse Name="OuterEllipse" |
|
|
|
Width="20" Height="20" |
|
|
|
UseLayoutRounding="False" |
|
|
|
Stroke="{DynamicResource RadioButtonOuterEllipseStroke}" |
|
|
|
Fill="{StaticResource RadioButtonOuterEllipseFill}" |
|
|
|
StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" /> |
|
|
|
|
|
|
|
<Ellipse Name="CheckOuterEllipse" |
|
|
|
Width="20" Height="20" |
|
|
|
UseLayoutRounding="False" |
|
|
|
Stroke="{DynamicResource RadioButtonOuterEllipseCheckedStroke}" |
|
|
|
Fill="{DynamicResource RadioButtonOuterEllipseCheckedFill}" |
|
|
|
StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" /> |
|
|
|
|
|
|
|
<Ellipse Name="CheckGlyph" |
|
|
|
Width="8" Height="8" |
|
|
|
UseLayoutRounding="False" |
|
|
|
Fill="{DynamicResource RadioButtonCheckGlyphFill}" |
|
|
|
Stroke="{DynamicResource RadioButtonCheckGlyphStroke}" /> |
|
|
|
</Grid> |
|
|
|
<ContentPresenter Name="PART_ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" TextBlock.Foreground="{TemplateBinding Foreground}" Margin="{TemplateBinding Padding}" |
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" /> |
|
|
|
|
|
|
|
<ContentPresenter Name="PART_ContentPresenter" |
|
|
|
Content="{TemplateBinding Content}" |
|
|
|
ContentTemplate="{TemplateBinding ContentTemplate}" |
|
|
|
TextBlock.Foreground="{TemplateBinding Foreground}" |
|
|
|
Margin="{TemplateBinding Padding}" |
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
|
|
|
Grid.Column="1" /> |
|
|
|
</Grid> |
|
|
|
</Border> |
|
|
|
</ControlTemplate> |
|
|
|
</Setter> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<!-- Normal State --> |
|
|
|
<Style Selector="RadioButton /template/ Ellipse#CheckGlyph"> |
|
|
|
<Setter Property="Opacity" Value="0" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<Style Selector="RadioButton:pressed /template/ Ellipse#CheckOuterEllipse"> |
|
|
|
<Setter Property="Opacity" Value="0" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<!-- PointerOver State --> |
|
|
|
<Style Selector="RadioButton:pointerover /template/ ContentPresenter#PART_ContentPresenter"> |
|
|
|
<Setter Property="(TextBlock.Foreground)" Value="{DynamicResource RadioButtonForegroundPointerOver}" /> |
|
|
|
@ -49,6 +89,7 @@ |
|
|
|
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckGlyphFillPointerOver}" /> |
|
|
|
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckGlyphStrokePointerOver}" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<!-- Pressed State --> |
|
|
|
<Style Selector="RadioButton:pressed /template/ ContentPresenter#PART_ContentPresenter"> |
|
|
|
<Setter Property="(TextBlock.Foreground)" Value="{DynamicResource RadioButtonForegroundPressed}" /> |
|
|
|
@ -69,6 +110,7 @@ |
|
|
|
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckGlyphFillPressed}" /> |
|
|
|
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckGlyphStrokePressed}" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<!-- Disabled State --> |
|
|
|
<Style Selector="RadioButton:disabled /template/ ContentPresenter#PART_ContentPresenter"> |
|
|
|
<Setter Property="(TextBlock.Foreground)" Value="{DynamicResource RadioButtonForegroundDisabled}" /> |
|
|
|
@ -89,6 +131,7 @@ |
|
|
|
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckGlyphFillDisabled}" /> |
|
|
|
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckGlyphStrokeDisabled}" /> |
|
|
|
</Style> |
|
|
|
|
|
|
|
<!-- Checked State --> |
|
|
|
<Style Selector="RadioButton:checked /template/ Ellipse#CheckGlyph"> |
|
|
|
<Setter Property="Opacity" Value="1" /> |
|
|
|
|