fix: unify RadioButton & CheckBox themes of ListBox.

(cherry picked from commit 4b53300909d00a09e3c6a63d6742d8c284218de3)
This commit is contained in:
Zhang Dian 2024-11-06 18:00:17 +08:00
parent f1836b0892
commit 782749f0dc
2 changed files with 107 additions and 135 deletions

View File

@ -16,7 +16,7 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" /> <Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="ListBox.Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBox"> <ControlTemplate TargetType="ListBox">
<Border <Border
Name="border" Name="border"
@ -95,13 +95,13 @@
<!-- RadioGroup --> <!-- RadioGroup -->
<ControlTheme x:Key="RadioGroupListBox" TargetType="ListBox"> <ControlTheme x:Key="RadioGroupListBox" TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource RadioGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource RadioGroupListBoxItem}" />
<Setter Property="ListBox.ItemsPanel"> <Setter Property="ItemsPanel">
<ItemsPanelTemplate> <ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" /> <StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</Setter> </Setter>
<Setter Property="ListBox.Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBox"> <ControlTemplate TargetType="ListBox">
<Border <Border
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
@ -117,29 +117,29 @@
</Setter> </Setter>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="RadioGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="RadioGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="ListBoxItem.HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="ListBoxItem.VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="ListBoxItem.Cursor" Value="Hand" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="ListBoxItem.HorizontalContentAlignment" Value="Left" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ListBoxItem.VerticalContentAlignment" Value="Center" /> <Setter Property="FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" />
<Setter Property="ListBoxItem.FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupForeground}" />
<Setter Property="ListBoxItem.CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupBoxCornerRadius}" /> <Setter Property="Background" Value="{DynamicResource ListBoxItemRadioGroupDefaultBackground}" />
<Setter Property="ListBoxItem.Foreground" Value="{DynamicResource ListBoxItemRadioGroupForeground}" /> <Setter Property="BorderBrush" Value="{DynamicResource ListBoxItemRadioGroupDefaultBorderBrush}" />
<Setter Property="ListBoxItem.Background" Value="{DynamicResource ListBoxItemRadioGroupDefaultBackground}" /> <Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupBoxCornerRadius}" />
<Setter Property="ListBoxItem.BorderBrush" Value="{DynamicResource ListBoxItemRadioGroupDefaultBorderBrush}" /> <Setter Property="Cursor" Value="Hand" />
<Setter Property="ListBoxItem.Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<Border <Border
Name="RootBorder" Name="RootBorder"
Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*"> <Grid ColumnDefinitions="Auto,*">
<Grid Margin="{DynamicResource ListBoxItemRadioGroupIconMargin}" <Panel
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Ellipse <Ellipse
Name="OuterEllipse" Name="OuterEllipse"
Width="{DynamicResource ListBoxItemRadioGroupIconRadius}" Width="{DynamicResource ListBoxItemRadioGroupIconRadius}"
@ -154,23 +154,22 @@
Width="{DynamicResource ListBoxItemRadioGroupGlyphRadius}" Width="{DynamicResource ListBoxItemRadioGroupGlyphRadius}"
Height="{DynamicResource ListBoxItemRadioGroupGlyphRadius}" Height="{DynamicResource ListBoxItemRadioGroupGlyphRadius}"
Fill="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}" Fill="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}"
Opacity="0"
Stroke="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}" Stroke="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}"
StrokeThickness="0"
UseLayoutRounding="False" /> UseLayoutRounding="False" />
</Grid> </Panel>
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Grid.Column="1" Grid.Column="1"
Margin="{DynamicResource ListBoxItemRadioGroupContentMargin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
FontSize="{TemplateBinding FontSize}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextElement.FontSize="{DynamicResource ListBoxItemRadioGroupFontSize}" TextWrapping="Wrap" />
TextElement.Foreground="{DynamicResource ListBoxItemRadioGroupForeground}" />
</Grid> </Grid>
</Border> </Border>
@ -190,13 +189,9 @@
<!-- Unchecked Pointerover State --> <!-- Unchecked Pointerover State -->
<Style Selector="^:pointerover"> <Style Selector="^:pointerover">
<Style Selector="^ /template/ Ellipse#OuterEllipse"> <Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" <Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBorderBrush}" />
Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
</Style> </Style>
<!-- Unchecked Pressed State --> <!-- Unchecked Pressed State -->
@ -205,9 +200,6 @@
<Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBorderBrush}" /> <Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
</Style> </Style>
<!-- Unchecked Disabled state --> <!-- Unchecked Disabled state -->
@ -216,9 +208,6 @@
<Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBorderBrush}" /> <Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" />
</Style> </Style>
@ -242,9 +231,6 @@
<Setter Property="Fill" <Setter Property="Fill"
Value="{DynamicResource ListBoxItemRadioGroupCheckIconPointeroverBackground}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconPointeroverBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
</Style> </Style>
<!-- Checked Pressed State --> <!-- Checked Pressed State -->
@ -254,9 +240,6 @@
Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
</Style> </Style>
<!-- Checked Disabled State --> <!-- Checked Disabled State -->
@ -266,9 +249,6 @@
Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" />
</Style> </Style>
@ -280,19 +260,18 @@
<ControlTheme x:Key="ButtonRadioGroupListBox" <ControlTheme x:Key="ButtonRadioGroupListBox"
BasedOn="{StaticResource RadioGroupListBox}" BasedOn="{StaticResource RadioGroupListBox}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource ButtonRadioGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource ButtonRadioGroupListBoxItem}" />
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="ButtonRadioGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="ButtonRadioGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="ListBoxItem.CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupButtonCornerRadius}" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ListBoxItem.VerticalContentAlignment" Value="Center" /> <Setter Property="Padding" Value="{DynamicResource ListBoxItemRadioGroupButtonDefaultPadding}" />
<Setter Property="ListBoxItem.Margin" Value="2" /> <Setter Property="Margin" Value="2" />
<Setter Property="ListBoxItem.Cursor" Value="Hand" /> <Setter Property="FontWeight" Value="{DynamicResource ListBoxItemRadioGroupButtonFontWeight}" />
<Setter Property="ListBoxItem.FontWeight" Value="{DynamicResource ListBoxItemRadioGroupButtonFontWeight}" /> <Setter Property="FontSize" Value="{DynamicResource ListBoxItemRadioGroupButtonDefaultFontSize}" />
<Setter Property="ListBoxItem.FontSize" Value="{DynamicResource ListBoxItemRadioGroupButtonDefaultFontSize}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupButtonUncheckedForeground}" />
<Setter Property="ListBoxItem.Padding" Value="{DynamicResource ListBoxItemRadioGroupButtonDefaultPadding}" /> <Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupButtonCornerRadius}" />
<Setter Property="ListBoxItem.Foreground" <Setter Property="Cursor" Value="Hand" />
Value="{DynamicResource ListBoxItemRadioGroupButtonUncheckedForeground}" /> <Setter Property="Template">
<Setter Property="ListBoxItem.Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
@ -312,7 +291,7 @@
UseLayoutRounding="False" /> UseLayoutRounding="False" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Setter Property="ListBoxItem.Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Style Selector="^:pointerover"> <Style Selector="^:pointerover">
<Setter Property="Background" <Setter Property="Background"
Value="{DynamicResource ListBoxItemRadioGroupButtonUncheckedPointeroverBackground}" /> Value="{DynamicResource ListBoxItemRadioGroupButtonUncheckedPointeroverBackground}" />
@ -345,24 +324,21 @@
<ControlTheme x:Key="CardRadioGroupListBox" <ControlTheme x:Key="CardRadioGroupListBox"
BasedOn="{StaticResource RadioGroupListBox}" BasedOn="{StaticResource RadioGroupListBox}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource CardRadioGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource CardRadioGroupListBoxItem}" />
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="CardRadioGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="CardRadioGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="ListBoxItem.Padding" Value="{DynamicResource ListBoxItemRadioGroupCardPadding}" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="ListBoxItem.BorderThickness" Value="1" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ListBoxItem.CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupCardCornerRadius}" /> <Setter Property="Padding" Value="{DynamicResource ListBoxItemRadioGroupCardPadding}" />
<Setter Property="ListBoxItem.Cursor" Value="Hand" /> <Setter Property="FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" />
<Setter Property="ListBoxItem.HorizontalAlignment" Value="Left" /> <Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupCardCornerRadius}" />
<Setter Property="ListBoxItem.VerticalAlignment" Value="Center" /> <Setter Property="Background" Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBackground}" />
<Setter Property="ListBoxItem.HorizontalContentAlignment" Value="Left" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="ListBoxItem.VerticalContentAlignment" Value="Center" /> <Setter Property="Cursor" Value="Hand" />
<Setter Property="ListBoxItem.Background" Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBackground}" />
<Setter Property="ListBoxItem.FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<Border <Border
Name="RootBorder" Name="RootBorder"
Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
@ -372,7 +348,10 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*"> ColumnDefinitions="Auto,*">
<Grid Margin="{DynamicResource ListBoxItemRadioGroupIconMargin}" VerticalAlignment="Top"> <Panel
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource ListBoxItemRadioGroupIconMargin}">
<Ellipse <Ellipse
Name="OuterEllipse" Name="OuterEllipse"
Width="{DynamicResource ListBoxItemRadioGroupIconRadius}" Width="{DynamicResource ListBoxItemRadioGroupIconRadius}"
@ -387,22 +366,23 @@
Width="{DynamicResource ListBoxItemRadioGroupGlyphRadius}" Width="{DynamicResource ListBoxItemRadioGroupGlyphRadius}"
Height="{DynamicResource ListBoxItemRadioGroupGlyphRadius}" Height="{DynamicResource ListBoxItemRadioGroupGlyphRadius}"
Fill="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}" Fill="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}"
Opacity="0"
Stroke="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}" Stroke="{DynamicResource ListBoxItemRadioGroupCheckGlyphFill}"
StrokeThickness="0"
UseLayoutRounding="False" /> UseLayoutRounding="False" />
</Grid> </Panel>
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Grid.Column="1" Grid.Column="1"
Margin="{DynamicResource ListBoxItemRadioGroupContentMargin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextElement.FontSize="{DynamicResource ListBoxItemRadioGroupFontSize}" FontSize="{TemplateBinding FontSize}"
TextElement.Foreground="{DynamicResource ListBoxItemRadioGroupForeground}" /> TextWrapping="Wrap" />
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
@ -425,9 +405,6 @@
<Setter Property="Stroke" <Setter Property="Stroke"
Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPointeroverBorderBrush}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
</Style> </Style>
<!-- Unchecked Pressed State --> <!-- Unchecked Pressed State -->
@ -437,9 +414,6 @@
<Style Selector="^ /template/ Ellipse#OuterEllipse"> <Style Selector="^ /template/ Ellipse#OuterEllipse">
<Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBorderBrush}" /> <Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconPressedBorderBrush}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
</Style> </Style>
<!-- Unchecked Disabled state --> <!-- Unchecked Disabled state -->
@ -448,9 +422,6 @@
<Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBorderBrush}" /> <Setter Property="Stroke" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupUncheckIconDisabledBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemRadioGroupDisabledForeground}" />
</Style> </Style>
@ -486,9 +457,6 @@
<Setter Property="Fill" <Setter Property="Fill"
Value="{DynamicResource ListBoxItemRadioGroupCheckIconPointeroverBackground}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconPointeroverBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
</Style> </Style>
<!-- Checked Pressed State --> <!-- Checked Pressed State -->
@ -500,9 +468,6 @@
Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconPressedBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
</Style> </Style>
<!-- Checked Disabled State --> <!-- Checked Disabled State -->
@ -512,9 +477,6 @@
Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBorderBrush}" />
<Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" /> <Setter Property="Fill" Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" />
</Style> </Style>
<Style Selector="^ /template/ Ellipse#CheckGlyph">
<Setter Property="Opacity" Value="1" />
</Style>
<Style Selector="^ /template/ Border#RootBorder"> <Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" <Setter Property="BorderBrush"
Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" /> Value="{DynamicResource ListBoxItemRadioGroupCheckIconDisabledBackground}" />
@ -531,24 +493,25 @@
<ControlTheme x:Key="PureCardRadioGroupListBox" <ControlTheme x:Key="PureCardRadioGroupListBox"
BasedOn="{StaticResource RadioGroupListBox}" BasedOn="{StaticResource RadioGroupListBox}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource PureCardRadioGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource PureCardRadioGroupListBoxItem}" />
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="PureCardRadioGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="PureCardRadioGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="ListBoxItem.CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupCardCornerRadius}" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="ListBoxItem.Cursor" Value="Hand" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ListBoxItem.VerticalContentAlignment" Value="Center" /> <Setter Property="Padding" Value="{DynamicResource ListBoxItemRadioGroupCardPadding}" />
<Setter Property="ListBoxItem.BorderThickness" Value="1" /> <Setter Property="FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" />
<Setter Property="ListBoxItem.FontSize" Value="{DynamicResource ListBoxItemRadioGroupFontSize}" /> <Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemRadioGroupCardCornerRadius}" />
<Setter Property="ListBoxItem.Padding" Value="{DynamicResource ListBoxItemRadioGroupCardPadding}" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="ListBoxItem.Background" Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBackground}" /> <Setter Property="Background" Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBackground}" />
<Setter Property="ListBoxItem.Template"> <Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
@ -556,10 +519,11 @@
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
UseLayoutRounding="False" /> UseLayoutRounding="False"
TextWrapping="Wrap" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Setter Property="ListBoxItem.BorderBrush" <Setter Property="BorderBrush"
Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBorderBrush}" /> Value="{DynamicResource ListBoxItemRadioGroupCardDefaultBorderBrush}" />
<Style Selector="^:pointerover"> <Style Selector="^:pointerover">
<Setter Property="Background" <Setter Property="Background"
@ -603,21 +567,19 @@
<ControlTheme x:Key="CheckGroupListBox" <ControlTheme x:Key="CheckGroupListBox"
BasedOn="{StaticResource RadioGroupListBox}" BasedOn="{StaticResource RadioGroupListBox}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource CheckGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource CheckGroupListBoxItem}" />
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="CheckGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="CheckGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="Padding" Value="8,0,0,0" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ListBoxItemCheckFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource ListBoxItemCheckFontSize}" />
<Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemCheckBoxCornerRadius}" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckForeground}" />
<Setter Property="Background" Value="{DynamicResource ListBoxItemCheckDefaultBackground}" /> <Setter Property="Background" Value="{DynamicResource ListBoxItemCheckDefaultBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ListBoxItemCheckDefaultBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ListBoxItemCheckDefaultBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemCheckBoxCornerRadius}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<Border <Border
@ -626,11 +588,11 @@
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid Name="RootGrid" ColumnDefinitions="Auto,*"> <Grid ColumnDefinitions="Auto,*">
<Grid <Panel
Grid.Column="0" Grid.Column="0"
Margin="0,0,0,0" TemplatedControl.IsTemplateFocusTarget="True"
VerticalAlignment="Center"> VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Border <Border
Name="NormalRectangle" Name="NormalRectangle"
Width="{DynamicResource ListBoxItemCheckBoxWidth}" Width="{DynamicResource ListBoxItemCheckBoxWidth}"
@ -645,16 +607,17 @@
Width="{DynamicResource ListBoxItemCheckBoxGlyphWidth}" Width="{DynamicResource ListBoxItemCheckBoxGlyphWidth}"
Height="{DynamicResource ListBoxItemCheckBoxGlyphHeight}" Height="{DynamicResource ListBoxItemCheckBoxGlyphHeight}"
Foreground="{DynamicResource ListBoxItemCheckGlyphFill}" /> Foreground="{DynamicResource ListBoxItemCheckGlyphFill}" />
</Grid> </Panel>
<ContentPresenter <ContentPresenter
Name="ContentPresenter" Name="PART_ContentPresenter"
Grid.Column="1" Grid.Column="1"
Margin="{TemplateBinding Padding}" Margin="{DynamicResource ListBoxItemCheckBoxContentMargin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}" IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
FontSize="{TemplateBinding FontSize}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Grid> </Grid>
@ -680,7 +643,7 @@
<!-- 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 ListBoxItemCheckDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckDisabledForeground}" />
</Style> </Style>
<Style Selector="^ /template/ Border#NormalRectangle"> <Style Selector="^ /template/ Border#NormalRectangle">
@ -720,7 +683,7 @@
<!-- Checked Disabled State --> <!-- Checked Disabled State -->
<Style Selector="^:disabled"> <Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckDisabledForeground}" />
</Style> </Style>
<Style Selector="^ /template/ Border#NormalRectangle"> <Style Selector="^ /template/ Border#NormalRectangle">
@ -765,7 +728,7 @@
<!-- Checked Disabled State --> <!-- Checked Disabled State -->
<Style Selector="^:disabled"> <Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ListBoxItemCheckDisabledForeground}" />
</Style> </Style>
<Style Selector="^ /template/ Border#NormalRectangle"> <Style Selector="^ /template/ Border#NormalRectangle">
@ -784,16 +747,18 @@
<ControlTheme x:Key="CardCheckGroupListBox" <ControlTheme x:Key="CardCheckGroupListBox"
BasedOn="{StaticResource RadioGroupListBox}" BasedOn="{StaticResource RadioGroupListBox}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="ListBox.ItemContainerTheme" Value="{DynamicResource CardCheckGroupListBoxItem}" /> <Setter Property="ItemContainerTheme" Value="{DynamicResource CardCheckGroupListBoxItem}" />
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="CardCheckGroupListBoxItem" TargetType="ListBoxItem"> <ControlTheme x:Key="CardCheckGroupListBoxItem" TargetType="ListBoxItem">
<Setter Property="Cursor" Value="Hand" /> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{DynamicResource ListBoxItemCheckCardPadding}" /> <Setter Property="Padding" Value="{DynamicResource ListBoxItemCheckCardPadding}" />
<Setter Property="BorderThickness" Value="{DynamicResource ListBoxItemCheckCardBorderThickness}" /> <Setter Property="FontSize" Value="{DynamicResource CheckBoxFontSize}" />
<Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemCheckCardCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ListBoxItemCheckCardCornerRadius}" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="ListBoxItem.Template"> <Setter Property="BorderThickness" Value="{DynamicResource ListBoxItemCheckCardBorderThickness}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="ListBoxItem">
<Border <Border
Name="RootBorder" Name="RootBorder"
@ -803,11 +768,13 @@
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid <Grid
Name="RootGrid"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ColumnDefinitions="Auto,*"> ColumnDefinitions="Auto,*">
<Grid Grid.Column="0" VerticalAlignment="Top"> <Panel
Grid.Column="0"
VerticalAlignment="Top"
Margin="{DynamicResource ListBoxItemCheckBoxIconMargin}">
<Border <Border
Name="NormalRectangle" Name="NormalRectangle"
Width="{DynamicResource ListBoxItemCheckBoxWidth}" Width="{DynamicResource ListBoxItemCheckBoxWidth}"
@ -822,17 +789,19 @@
Width="{DynamicResource ListBoxItemCheckBoxGlyphWidth}" Width="{DynamicResource ListBoxItemCheckBoxGlyphWidth}"
Height="{DynamicResource ListBoxItemCheckBoxGlyphHeight}" Height="{DynamicResource ListBoxItemCheckBoxGlyphHeight}"
Foreground="{DynamicResource ListBoxItemCheckGlyphFill}" /> Foreground="{DynamicResource ListBoxItemCheckGlyphFill}" />
</Panel>
</Grid>
<ContentPresenter <ContentPresenter
Name="ContentPresenter" Name="PART_ContentPresenter"
Grid.Column="1" Grid.Column="1"
Margin="8,0,0,0" Margin="{DynamicResource ListBoxItemCheckBoxContentMargin}"
VerticalAlignment="Center" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content, Foreground="{TemplateBinding Foreground}"
Converter={x:Static ObjectConverters.IsNotNull}}" IsVisible="{TemplateBinding Content,Converter={x:Static ObjectConverters.IsNotNull}}"
FontSize="{TemplateBinding FontSize}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Grid> </Grid>

View File

@ -7,7 +7,8 @@
<x:Double x:Key="ListBoxItemRadioGroupIconRadius">16</x:Double> <x:Double x:Key="ListBoxItemRadioGroupIconRadius">16</x:Double>
<x:Double x:Key="ListBoxItemRadioGroupGlyphRadius">6</x:Double> <x:Double x:Key="ListBoxItemRadioGroupGlyphRadius">6</x:Double>
<x:Double x:Key="ListBoxItemRadioGroupFontSize">14</x:Double> <x:Double x:Key="ListBoxItemRadioGroupFontSize">14</x:Double>
<Thickness x:Key="ListBoxItemRadioGroupIconMargin">0 2 8 0</Thickness> <Thickness x:Key="ListBoxItemRadioGroupIconMargin">0 2 0 0</Thickness>
<Thickness x:Key="ListBoxItemRadioGroupContentMargin">8 0 0 0</Thickness>
<CornerRadius x:Key="ListBoxItemRadioGroupBoxCornerRadius">3</CornerRadius> <CornerRadius x:Key="ListBoxItemRadioGroupBoxCornerRadius">3</CornerRadius>
<!-- ButtonRadioGroupListBox --> <!-- ButtonRadioGroupListBox -->
@ -35,12 +36,14 @@
<CornerRadius x:Key="ListBoxItemCheckBoxCornerRadius">3</CornerRadius> <CornerRadius x:Key="ListBoxItemCheckBoxCornerRadius">3</CornerRadius>
<Thickness x:Key="ListBoxItemCheckBoxBorderThickness">1</Thickness> <Thickness x:Key="ListBoxItemCheckBoxBorderThickness">1</Thickness>
<Thickness x:Key="ListBoxItemCheckBoxIconMargin">0 2 0 0</Thickness>
<Thickness x:Key="ListBoxItemCheckBoxContentMargin">8 0 0 0</Thickness>
<StreamGeometry x:Key="ListBoxItemCheckCheckGlyph">M17.4111 7.30848C18.0692 7.81171 18.1947 8.75312 17.6915 9.41119L11.1915 17.9112C10.909 18.2806 10.4711 18.4981 10.0061 18.5C9.54105 18.5019 9.10143 18.288 8.81592 17.9209L5.31592 13.4209C4.80731 12.767 4.92512 11.8246 5.57904 11.316C6.23296 10.8074 7.17537 10.9252 7.68398 11.5791L9.98988 14.5438L15.3084 7.58884C15.8116 6.93077 16.7531 6.80525 17.4111 7.30848Z</StreamGeometry> <StreamGeometry x:Key="ListBoxItemCheckCheckGlyph">M17.4111 7.30848C18.0692 7.81171 18.1947 8.75312 17.6915 9.41119L11.1915 17.9112C10.909 18.2806 10.4711 18.4981 10.0061 18.5C9.54105 18.5019 9.10143 18.288 8.81592 17.9209L5.31592 13.4209C4.80731 12.767 4.92512 11.8246 5.57904 11.316C6.23296 10.8074 7.17537 10.9252 7.68398 11.5791L9.98988 14.5438L15.3084 7.58884C15.8116 6.93077 16.7531 6.80525 17.4111 7.30848Z</StreamGeometry>
<StreamGeometry x:Key="ListBoxItemCheckIndeterminateGlyph">M5 12.5C5 11.6716 5.67157 11 6.5 11H17.5C18.3284 11 19 11.6716 19 12.5C19 13.3284 18.3284 14 17.5 14H6.5C5.67157 14 5 13.3284 5 12.5Z</StreamGeometry> <StreamGeometry x:Key="ListBoxItemCheckIndeterminateGlyph">M5 12.5C5 11.6716 5.67157 11 6.5 11H17.5C18.3284 11 19 11.6716 19 12.5C19 13.3284 18.3284 14 17.5 14H6.5C5.67157 14 5 13.3284 5 12.5Z</StreamGeometry>
<!-- CardCheckGroupListBox --> <!-- CardCheckGroupListBox -->
<Thickness x:Key="ListBoxItemCheckCardBorderThickness">1</Thickness> <Thickness x:Key="ListBoxItemCheckCardBorderThickness">1</Thickness>
<Thickness x:Key="ListBoxItemCheckCardPadding">16</Thickness> <Thickness x:Key="ListBoxItemCheckCardPadding">16 12</Thickness>
<CornerRadius x:Key="ListBoxItemCheckCardCornerRadius">3</CornerRadius> <CornerRadius x:Key="ListBoxItemCheckCardCornerRadius">3</CornerRadius>
</ResourceDictionary> </ResourceDictionary>