mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-05-03 22:41:29 +08:00
Merge pull request #162 from irihitech/150-radiobutton
RadioButton and CheckBox alignment issue
This commit is contained in:
@@ -180,6 +180,7 @@
|
|||||||
|
|
||||||
<ControlTheme x:Key="CardCheckBox" TargetType="CheckBox">
|
<ControlTheme x:Key="CardCheckBox" TargetType="CheckBox">
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="Padding" Value="{DynamicResource CheckBoxCardPadding}" />
|
<Setter Property="Padding" Value="{DynamicResource CheckBoxCardPadding}" />
|
||||||
<Setter Property="BorderThickness" Value="{DynamicResource CheckBoxCardBorderThickness}" />
|
<Setter Property="BorderThickness" Value="{DynamicResource CheckBoxCardBorderThickness}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource CheckBoxCardCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource CheckBoxCardCornerRadius}" />
|
||||||
@@ -193,7 +194,11 @@
|
|||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid x:Name="RootGrid" ColumnDefinitions="Auto,*">
|
<Grid
|
||||||
|
x:Name="RootGrid"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
ColumnDefinitions="Auto,*">
|
||||||
<Grid Grid.Column="0" VerticalAlignment="Top">
|
<Grid Grid.Column="0" VerticalAlignment="Top">
|
||||||
<Border
|
<Border
|
||||||
x:Name="NormalRectangle"
|
x:Name="NormalRectangle"
|
||||||
@@ -215,7 +220,6 @@
|
|||||||
x:Name="ContentPresenter"
|
x:Name="ContentPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
@@ -376,87 +380,82 @@
|
|||||||
<Setter Property="Padding" Value="{DynamicResource CheckBoxCardPadding}" />
|
<Setter Property="Padding" Value="{DynamicResource CheckBoxCardPadding}" />
|
||||||
<Setter Property="BorderThickness" Value="{DynamicResource CheckBoxCardBorderThickness}" />
|
<Setter Property="BorderThickness" Value="{DynamicResource CheckBoxCardBorderThickness}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource CheckBoxCardCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource CheckBoxCardCornerRadius}" />
|
||||||
|
<Setter Property="CheckBox.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="CheckBox.Template">
|
<Setter Property="CheckBox.Template">
|
||||||
<ControlTemplate TargetType="CheckBox">
|
<ControlTemplate TargetType="CheckBox">
|
||||||
<Border
|
<ContentPresenter
|
||||||
Name="RootBorder"
|
x:Name="PART_ContentPresenter"
|
||||||
|
Margin="{TemplateBinding Margin}"
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
Content="{TemplateBinding Content}"
|
||||||
<ContentPresenter
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
x:Name="ContentPresenter"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
Grid.Column="1"
|
RecognizesAccessKey="True"
|
||||||
Margin="8,0,0,0"
|
UseLayoutRounding="False" />
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Content="{TemplateBinding Content}"
|
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
||||||
IsVisible="{TemplateBinding Content,
|
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}"
|
|
||||||
RecognizesAccessKey="True"
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<!-- Unchecked Pointerover State -->
|
<!-- Unchecked Pointerover State -->
|
||||||
<Style Selector="^:pointerover">
|
<Style Selector="^:pointerover">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Background" Value="{DynamicResource CheckBoxCardPointeroverBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CheckBoxCardPointeroverBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Unchecked Pressed State -->
|
<!-- Unchecked Pressed State -->
|
||||||
<Style Selector="^:pressed">
|
<Style Selector="^:pressed">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Background" Value="{DynamicResource CheckBoxCardPressedBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CheckBoxCardPressedBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Unchecked Disabled state -->
|
<!-- Unchecked Disabled state -->
|
||||||
<Style Selector="^:disabled">
|
<Style Selector="^:disabled">
|
||||||
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:checked">
|
<Style Selector="^:checked">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedBorderBrush}" />
|
||||||
<Setter Property="Background" Value="{DynamicResource CheckBoxCardCheckedBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CheckBoxCardCheckedBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pointerover /template/ Border#RootBorder">
|
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPointeroverBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPointeroverBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pressed /template/ Border#RootBorder">
|
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPressedBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPressedBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<!-- Checked Disabled State -->
|
<!-- Checked Disabled State -->
|
||||||
<Style Selector="^:disabled">
|
<Style Selector="^:disabled">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:indeterminate">
|
<Style Selector="^:indeterminate">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pointerover /template/ Border#RootBorder">
|
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPointeroverBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPointeroverBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pressed /template/ Border#RootBorder">
|
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPressedBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedPressedBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:disabled">
|
<Style Selector="^:disabled">
|
||||||
<Style Selector="^ /template/ Border#RootBorder">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
<Grid ColumnDefinitions="Auto,*">
|
||||||
<Grid Margin="{DynamicResource RadioButtonIconMargin}" VerticalAlignment="Top">
|
<Grid Margin="{DynamicResource RadioButtonIconMargin}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Name="OuterEllipse"
|
Name="OuterEllipse"
|
||||||
Width="{DynamicResource RadioButtonIconRadius}"
|
Width="{DynamicResource RadioButtonIconRadius}"
|
||||||
@@ -169,6 +169,7 @@
|
|||||||
|
|
||||||
<ControlTheme x:Key="ButtonRadioButton" TargetType="RadioButton">
|
<ControlTheme x:Key="ButtonRadioButton" TargetType="RadioButton">
|
||||||
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonButtonCornerRadius}" />
|
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonButtonCornerRadius}" />
|
||||||
|
<Setter Property="RadioButton.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="RadioButton.Margin" Value="2" />
|
<Setter Property="RadioButton.Margin" Value="2" />
|
||||||
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
||||||
<Setter Property="RadioButton.FontWeight" Value="{DynamicResource RadioButtonButtonFontWeight}" />
|
<Setter Property="RadioButton.FontWeight" Value="{DynamicResource RadioButtonButtonFontWeight}" />
|
||||||
@@ -227,7 +228,7 @@
|
|||||||
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
|
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
|
||||||
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
||||||
<Setter Property="RadioButton.HorizontalAlignment" Value="Left" />
|
<Setter Property="RadioButton.HorizontalAlignment" Value="Left" />
|
||||||
<Setter Property="RadioButton.VerticalAlignment" Value="Top" />
|
<Setter Property="RadioButton.VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="RadioButton.HorizontalContentAlignment" Value="Left" />
|
<Setter Property="RadioButton.HorizontalContentAlignment" Value="Left" />
|
||||||
<Setter Property="RadioButton.VerticalContentAlignment" Value="Center" />
|
<Setter Property="RadioButton.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="RadioButton.Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
|
<Setter Property="RadioButton.Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
|
||||||
@@ -242,7 +243,10 @@
|
|||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
<Grid
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
ColumnDefinitions="Auto,*">
|
||||||
<Grid Margin="{DynamicResource RadioButtonIconMargin}" VerticalAlignment="Top">
|
<Grid Margin="{DynamicResource RadioButtonIconMargin}" VerticalAlignment="Top">
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Name="OuterEllipse"
|
Name="OuterEllipse"
|
||||||
@@ -267,7 +271,6 @@
|
|||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_ContentPresenter"
|
Name="PART_ContentPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
@@ -390,10 +393,10 @@
|
|||||||
<ControlTheme x:Key="PureCardRadioButton" TargetType="RadioButton">
|
<ControlTheme x:Key="PureCardRadioButton" TargetType="RadioButton">
|
||||||
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
|
<Setter Property="RadioButton.CornerRadius" Value="{DynamicResource RadioButtonCardCornerRadius}" />
|
||||||
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
<Setter Property="RadioButton.Cursor" Value="Hand" />
|
||||||
|
<Setter Property="RadioButton.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="RadioButton.BorderThickness" Value="1" />
|
<Setter Property="RadioButton.BorderThickness" Value="1" />
|
||||||
<Setter Property="RadioButton.FontSize" Value="{DynamicResource RadioButtonFontSize}" />
|
<Setter Property="RadioButton.FontSize" Value="{DynamicResource RadioButtonFontSize}" />
|
||||||
<Setter Property="RadioButton.Padding" Value="{DynamicResource RadioButtonCardPadding}" />
|
<Setter Property="RadioButton.Padding" Value="{DynamicResource RadioButtonCardPadding}" />
|
||||||
<Setter Property="RadioButton.Foreground" Value="{DynamicResource RadioButtonButtonUncheckedForeground}" />
|
|
||||||
<Setter Property="RadioButton.Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
|
<Setter Property="RadioButton.Background" Value="{DynamicResource RadioButtonCardDefaultBackground}" />
|
||||||
<Setter Property="RadioButton.Template">
|
<Setter Property="RadioButton.Template">
|
||||||
<ControlTemplate TargetType="RadioButton">
|
<ControlTemplate TargetType="RadioButton">
|
||||||
@@ -410,8 +413,6 @@
|
|||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
RecognizesAccessKey="True"
|
RecognizesAccessKey="True"
|
||||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
|
||||||
TextElement.FontWeight="{TemplateBinding FontWeight}"
|
|
||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|||||||
Reference in New Issue
Block a user