Files
Semi.Avalonia/src/Semi.Avalonia/Controls/CheckBox.axaml

440 lines
23 KiB
Plaintext
Raw Normal View History

<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
2022-12-09 15:23:16 +08:00
<ControlTheme x:Key="{x:Type CheckBox}" TargetType="CheckBox">
2022-12-09 01:14:49 +08:00
<Setter Property="Padding" Value="8,0,0,0" />
<Setter Property="VerticalAlignment" Value="Center" />
2023-03-17 23:12:24 +08:00
<Setter Property="HorizontalAlignment" Value="Stretch" />
2022-12-09 01:14:49 +08:00
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
2022-12-09 15:23:16 +08:00
<Setter Property="FontSize" Value="{DynamicResource CheckboxFontSize}" />
<Setter Property="CornerRadius" Value="{DynamicResource CheckboxBoxCornerRadius}" />
2022-12-09 01:14:49 +08:00
<Setter Property="MinHeight" Value="32" />
2022-12-09 15:23:16 +08:00
<Setter Property="Foreground" Value="{DynamicResource CheckboxForeground}" />
<Setter Property="Background" Value="{DynamicResource CheckboxDefaultBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxDefaultBorderBrush}" />
2022-12-09 01:14:49 +08:00
<Setter Property="Template">
<ControlTemplate TargetType="CheckBox">
2022-12-09 15:23:16 +08:00
<Grid x:Name="RootGrid" ColumnDefinitions="Auto,*">
2022-12-09 01:14:49 +08:00
<Border
2023-02-09 22:26:12 +08:00
x:Name="PART_Border"
Grid.Column="0"
Grid.ColumnSpan="2"
2023-03-17 23:12:24 +08:00
HorizontalAlignment="Center"
2022-12-09 01:14:49 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
2022-12-09 15:23:16 +08:00
CornerRadius="{TemplateBinding CornerRadius}" />
2022-12-09 01:14:49 +08:00
<Grid
2023-02-09 22:26:12 +08:00
Grid.Column="0"
Margin="0,0,0,0"
2023-02-09 22:26:12 +08:00
VerticalAlignment="Center">
2022-12-09 01:14:49 +08:00
<Border
2022-12-09 15:23:16 +08:00
x:Name="NormalRectangle"
Width="{DynamicResource CheckboxBoxWidth}"
Height="{DynamicResource CheckboxBoxHeight}"
Background="{DynamicResource CheckboxDefaultBackground}"
BorderBrush="{DynamicResource CheckboxDefaultBorderBrush}"
BorderThickness="{DynamicResource CheckboxBoxBorderThickness}"
2022-12-09 01:14:49 +08:00
CornerRadius="{TemplateBinding CornerRadius}"
2022-12-09 15:23:16 +08:00
UseLayoutRounding="False" />
2023-02-09 22:43:55 +08:00
<PathIcon
Name="CheckGlyph"
Width="{DynamicResource CheckboxBoxGlyphWidth}"
Height="{DynamicResource CheckboxBoxGlyphHeight}"
Foreground="{DynamicResource CheckboxGlyphFill}" />
2022-12-09 01:14:49 +08:00
</Grid>
<ContentPresenter
2023-02-09 22:26:12 +08:00
x:Name="ContentPresenter"
Grid.Column="1"
2022-12-09 01:14:49 +08:00
Margin="{TemplateBinding Padding}"
2022-12-09 15:23:16 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2023-02-09 22:26:12 +08:00
VerticalAlignment="Center"
2022-12-09 15:23:16 +08:00
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
2023-02-09 22:26:12 +08:00
RecognizesAccessKey="True"
TextWrapping="Wrap" />
2022-12-09 01:14:49 +08:00
</Grid>
</ControlTemplate>
</Setter>
<!-- Unchecked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPointOverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxPointOverBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Unchecked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxPressedBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Unchecked Disabled state -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
2022-12-09 15:23:16 +08:00
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
2022-12-09 01:14:49 +08:00
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxDefaultDisabledBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<Style Selector="^:checked">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDefaultBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDefaultBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
2023-02-09 22:43:55 +08:00
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxCheckGlyph}" />
2022-12-09 01:14:49 +08:00
<Setter Property="Opacity" Value="1" />
</Style>
<!-- Checked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPointOverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPointOverBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Checked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPressedBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Checked Disabled State -->
<Style Selector="^:disabled">
2022-12-09 15:23:16 +08:00
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
2023-03-17 23:12:24 +08:00
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckboxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
<Style Selector="^:indeterminate">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDefaultBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDefaultBackground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxIndeterminateGlyph}" />
<Setter Property="Opacity" Value="1" />
</Style>
<!-- Checked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPointOverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPointOverBackground}" />
</Style>
</Style>
<!-- Checked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPressedBackground}" />
</Style>
</Style>
<!-- Checked Disabled State -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckboxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="CardCheckBox" TargetType="CheckBox">
<Setter Property="Padding" Value="{DynamicResource CheckboxCardPadding}" />
<Setter Property="BorderThickness" Value="{DynamicResource CheckboxCardBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CheckboxCardCornerRadius}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CheckBox.Template">
<ControlTemplate TargetType="CheckBox">
<Border
Name="RootBorder"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid x:Name="RootGrid" ColumnDefinitions="Auto,*">
<Grid Grid.Column="0" VerticalAlignment="Top">
<Border
x:Name="NormalRectangle"
Width="{DynamicResource CheckboxBoxWidth}"
Height="{DynamicResource CheckboxBoxHeight}"
Background="{DynamicResource CheckboxDefaultBackground}"
BorderBrush="{DynamicResource CheckboxDefaultBorderBrush}"
BorderThickness="{DynamicResource CheckboxBoxBorderThickness}"
CornerRadius="{DynamicResource CheckboxBoxCornerRadius}"
UseLayoutRounding="False" />
<PathIcon
Name="CheckGlyph"
Width="{DynamicResource CheckboxBoxGlyphWidth}"
Height="{DynamicResource CheckboxBoxGlyphHeight}"
Foreground="{DynamicResource CheckboxGlyphFill}" />
</Grid>
<ContentPresenter
x:Name="ContentPresenter"
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
RecognizesAccessKey="True"
TextWrapping="Wrap" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
<!-- Unchecked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPointOverBorderBrush}" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource CheckboxCardPointeroverBackground}" />
</Style>
</Style>
<!-- Unchecked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPressedBorderBrush}" />
</Style>
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource CheckboxCardPressedBackground}" />
</Style>
</Style>
<!-- Unchecked Disabled state -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxDefaultDisabledBackground}" />
</Style>
</Style>
<Style Selector="^:checked">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCardCheckedBackground}" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDefaultBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDefaultBackground}" />
</Style>
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxCheckGlyph}" />
<Setter Property="Opacity" Value="1" />
</Style>
<!-- Checked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPointOverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPointOverBackground}" />
</Style>
</Style>
<!-- Checked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPressedBackground}" />
</Style>
</Style>
<!-- Checked Disabled State -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedDisabledBorderBrush}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
2022-12-09 15:23:16 +08:00
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
2022-12-09 01:14:49 +08:00
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDisabledBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
2022-12-09 15:23:16 +08:00
<Setter Property="Fill" Value="{DynamicResource CheckboxGlyphDisabledFill}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
</Style>
<Style Selector="^:indeterminate">
2023-03-17 23:20:39 +08:00
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedBorderBrush}" />
</Style>
2022-12-09 01:14:49 +08:00
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDefaultBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDefaultBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
2023-02-09 22:43:55 +08:00
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Data" Value="{DynamicResource CheckBoxIndeterminateGlyph}" />
2022-12-09 01:14:49 +08:00
<Setter Property="Opacity" Value="1" />
</Style>
<!-- Checked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPointOverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPointOverBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Checked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedPressedBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
<!-- Checked Disabled State -->
<Style Selector="^:disabled">
2023-03-17 23:20:39 +08:00
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedDisabledBorderBrush}" />
</Style>
2022-12-09 15:23:16 +08:00
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
2022-12-09 01:14:49 +08:00
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
2022-12-09 15:23:16 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCheckedDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCheckedDisabledBackground}" />
2022-12-09 01:14:49 +08:00
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
2022-12-09 15:23:16 +08:00
<Setter Property="Fill" Value="{DynamicResource CheckboxGlyphDisabledFill}" />
2022-12-09 01:14:49 +08:00
</Style>
</Style>
</Style>
</ControlTheme>
2023-03-17 23:20:39 +08:00
<ControlTheme x:Key="PureCardCheckBox" TargetType="CheckBox">
<Setter Property="Padding" Value="{DynamicResource CheckboxCardPadding}" />
<Setter Property="BorderThickness" Value="{DynamicResource CheckboxCardBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CheckboxCardCornerRadius}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CheckBox.Template">
<ControlTemplate TargetType="CheckBox">
<Border
Name="RootBorder"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
x:Name="ContentPresenter"
Grid.Column="1"
Margin="8,0,0,0"
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>
</Setter>
<!-- Unchecked PointerOver State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource CheckboxCardPointeroverBackground}" />
</Style>
</Style>
<!-- Unchecked Pressed State -->
<Style Selector="^:pressed">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource CheckboxCardPressedBackground}" />
</Style>
</Style>
<!-- Unchecked Disabled state -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
</Style>
</Style>
<Style Selector="^:checked">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CheckboxCardCheckedBackground}" />
</Style>
<!-- Checked Disabled State -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedDisabledBorderBrush}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource CheckboxDisabledForeground}" />
</Style>
</Style>
</Style>
<Style Selector="^:indeterminate">
<!-- Checked Disabled State -->
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedBorderBrush}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxCardCheckedDisabledBorderBrush}" />
</Style>
</Style>
</Style>
</ControlTheme>
2022-12-09 01:14:49 +08:00
</ResourceDictionary>