mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
179 lines
9.4 KiB
XML
179 lines
9.4 KiB
XML
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
x:CompileBindings="True">
|
|
<ControlTheme x:Key="{x:Type CheckBox}" TargetType="CheckBox">
|
|
<Setter Property="Padding" Value="8,0,0,0" />
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FontSize" Value="{DynamicResource CheckboxFontSize}" />
|
|
<Setter Property="CornerRadius" Value="{DynamicResource CheckboxBoxCornerRadius}" />
|
|
<Setter Property="MinHeight" Value="32" />
|
|
<Setter Property="Foreground" Value="{DynamicResource CheckboxForeground}" />
|
|
<Setter Property="Background" Value="{DynamicResource CheckboxDefaultBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxDefaultBorderBrush}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="CheckBox">
|
|
<Grid x:Name="RootGrid" ColumnDefinitions="Auto,*">
|
|
<Border
|
|
x:Name="PART_Border"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
|
|
<Grid
|
|
Grid.Column="0"
|
|
Margin="0,0,0,0"
|
|
VerticalAlignment="Center">
|
|
<Border
|
|
x:Name="NormalRectangle"
|
|
Width="{DynamicResource CheckboxBoxWidth}"
|
|
Height="{DynamicResource CheckboxBoxHeight}"
|
|
Background="{DynamicResource CheckboxDefaultBackground}"
|
|
BorderBrush="{DynamicResource CheckboxDefaultBorderBrush}"
|
|
BorderThickness="{DynamicResource CheckboxBoxBorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
UseLayoutRounding="False" />
|
|
<PathIcon
|
|
Name="CheckGlyph"
|
|
Width="{DynamicResource CheckboxBoxGlyphWidth}"
|
|
Height="{DynamicResource CheckboxBoxGlyphHeight}"
|
|
Foreground="{DynamicResource CheckboxGlyphFill}" />
|
|
|
|
</Grid>
|
|
<ContentPresenter
|
|
x:Name="ContentPresenter"
|
|
Grid.Column="1"
|
|
Margin="{TemplateBinding Padding}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
IsVisible="{TemplateBinding Content,
|
|
Converter={x:Static ObjectConverters.IsNotNull}}"
|
|
RecognizesAccessKey="True"
|
|
TextWrapping="Wrap" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<!-- Unchecked PointerOver State -->
|
|
<Style Selector="^:pointerover">
|
|
<Style Selector="^ /template/ Border#NormalRectangle">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPointOverBorderBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource CheckboxPointOverBackground}" />
|
|
</Style>
|
|
</Style>
|
|
|
|
<!-- Unchecked Pressed State -->
|
|
<Style Selector="^:pressed">
|
|
<Style Selector="^ /template/ Border#NormalRectangle">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource CheckboxPressedBorderBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource CheckboxPressedBackground}" />
|
|
</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#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/ 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>
|
|
|
|
<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>
|
|
</ResourceDictionary>
|