fix: fix template and foreground.

This commit is contained in:
rabbitism
2023-03-28 23:04:44 +08:00
parent 04dbe2d9ce
commit 2662059c6d
2 changed files with 22 additions and 31 deletions

View File

@@ -383,84 +383,78 @@
<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>

View File

@@ -397,7 +397,6 @@
<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">
@@ -414,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>