fix: add opacity to CheckGlyph.

This commit is contained in:
Zhang Dian
2025-04-26 18:23:39 +08:00
committed by Dong Bin
parent 62030c581c
commit 7056894c03
6 changed files with 67 additions and 24 deletions

View File

@@ -33,6 +33,7 @@
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
@@ -106,14 +107,10 @@
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -124,6 +121,12 @@
<Style Selector="^:checked /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxCheckGlyph}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
<ControlTheme
@@ -138,7 +141,9 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Panel
Name="PART_GlyphPanel"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Border
Name="NormalRectangle"
Width="{DynamicResource CheckBoxBoxWidth}"
@@ -183,6 +188,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource CheckBoxBoxMargin}">
@@ -279,7 +285,6 @@
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
@@ -287,9 +292,6 @@
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -305,6 +307,12 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCardCheckedBackground}" />
</Style>
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="PureCardCheckBox" TargetType="CheckBox">

View File

@@ -137,6 +137,7 @@
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
@@ -224,13 +225,18 @@
<Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
</Style>
</Style>
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
@@ -321,6 +327,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource RadioButtonIconMargin}">
@@ -431,7 +438,6 @@
<Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
@@ -442,6 +448,12 @@
</Style>
</Style>
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
@@ -539,6 +551,7 @@
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
@@ -612,20 +625,22 @@
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
<Style Selector="^:selected /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxCheckGlyph}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
@@ -657,6 +672,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource CheckBoxBoxMargin}">
@@ -753,7 +769,6 @@
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxCardCheckedDisabledBorderBrush}" />
@@ -761,8 +776,11 @@
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</Style>

View File

@@ -34,6 +34,7 @@
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
@@ -45,7 +46,6 @@
Stroke="{DynamicResource RadioButtonUncheckIconDefaultBorderBrush}"
StrokeThickness="{DynamicResource RadioButtonUncheckIconDefaultThickness}"
UseLayoutRounding="False" />
<Ellipse
Name="CheckGlyph"
Width="{DynamicResource RadioButtonGlyphRadius}"
@@ -121,13 +121,18 @@
<Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource RadioButtonDisabledForeground}" />
</Style>
</Style>
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="RadioButtonGroupBorder" TargetType="Border">
@@ -213,6 +218,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*">
<Panel
Name="PART_GlyphPanel"
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource RadioButtonIconMargin}">
@@ -323,7 +329,6 @@
<Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" Value="{DynamicResource RadioButtonCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
<Setter Property="Opacity" Value="0.75" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource RadioButtonCheckIconDisabledBackground}" />
@@ -334,6 +339,12 @@
</Style>
</Style>
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Panel#PART_GlyphPanel">
<Setter Property="Opacity" Value="0.75" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="PureCardRadioButton" TargetType="RadioButton">

View File

@@ -2,7 +2,6 @@
<StaticResource x:Key="CheckBoxForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="CheckBoxDisabledForeground" ResourceKey="SemiColorDisabledText" />
<StaticResource x:Key="CheckBoxGlyphFill" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
<SolidColorBrush x:Key="CheckBoxDefaultBackground" Color="Transparent" />
<StaticResource x:Key="CheckBoxDefaultBorderBrush" ResourceKey="SemiColorText3" />
<StaticResource x:Key="CheckBoxPointeroverBackground" ResourceKey="SemiColorFill0" />
@@ -26,4 +25,7 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
</ResourceDictionary>

View File

@@ -2,7 +2,6 @@
<StaticResource x:Key="CheckBoxForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="CheckBoxDisabledForeground" ResourceKey="SemiColorGrayText" />
<StaticResource x:Key="CheckBoxGlyphFill" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="CheckBoxDefaultBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="CheckBoxDefaultBorderBrush" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="CheckBoxPointeroverBackground" ResourceKey="SemiColorHighlightText" />
@@ -26,4 +25,7 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorHighlight" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorHighlightText" />
</ResourceDictionary>

View File

@@ -2,7 +2,6 @@
<StaticResource x:Key="CheckBoxForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="CheckBoxDisabledForeground" ResourceKey="SemiColorDisabledText" />
<StaticResource x:Key="CheckBoxGlyphFill" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
<SolidColorBrush x:Key="CheckBoxDefaultBackground" Color="Transparent" />
<StaticResource x:Key="CheckBoxDefaultBorderBrush" ResourceKey="SemiColorText3" />
<StaticResource x:Key="CheckBoxPointeroverBackground" ResourceKey="SemiColorFill0" />
@@ -26,4 +25,7 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
</ResourceDictionary>