feat: refactor ToggleButton styles.

This commit is contained in:
Zhang Dian
2025-05-18 15:08:49 +08:00
parent 926ebc39da
commit 5148c62d24
4 changed files with 124 additions and 385 deletions

View File

@@ -19,77 +19,10 @@
<ToggleButton Classes="Danger" IsThreeState="True">Toggle 3</ToggleButton>
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type ToggleButton}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultPrimaryForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ToggleButtonCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource ToggleButtonBorderThickness}" />
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="FontSize" Value="{DynamicResource ToggleButtonDefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource ToggleButtonDefaultFontWeight}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="ToggleButton">
<ContentPresenter
Name="PART_ContentPresenter"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="{TemplateBinding FontWeight}"
UseLayoutRounding="False" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultPressedBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
</Style>
<Style Selector="^.Primary">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultPrimaryForeground}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultSecondaryForeground}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultTertiaryForeground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultSuccessForeground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultWarningForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDangerForeground}" />
</Style>
<ControlTheme
x:Key="{x:Type ToggleButton}"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="ToggleButton">
<Style Selector="^:checked">
<Setter Property="FocusAdorner">
@@ -98,182 +31,155 @@
Classes="Solid" />
</FocusAdornerTemplate>
</Setter>
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonCheckedForeground}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryCheckedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidPrimaryPressedForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
</Style>
<Style Selector="^.Primary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidPrimaryPressedForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Secondary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Success">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Warning">
<Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Danger">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedBackground}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPointeroverBackground}" />
<Style Selector="^.Primary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPointeroverBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerBorderBrush}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedPointeroverBackground}" />
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPointeroverBorderBrush}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedPointeroverBackground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedPointeroverBackground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedPointeroverBackground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedPointeroverBackground}" />
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^:pressed">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedForeground}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBorderBrush}" />
<Style Selector="^.Primary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBorderBrush}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedPressedBackground}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedPressedBackground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedPressedBackground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedPressedBackground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedPressedBackground}" />
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonCheckedDisabledBackground}" />
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidDisabledForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDisabledBorderBrush}" />
</Style>
</Style>
<Style Selector="^:indeterminate">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBackground}" />
<Style Selector="^.Primary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBackground}" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryIndeterminateBackground}" />
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^.Primary /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^.Secondary /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryIndeterminateBackground}" />
<Style Selector="^.Tertiary /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminateBorderBrush}" />
</Style>
<Style Selector="^.Success">
<Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessIndeterminateBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminateBorderBrush}" />
<Style Selector="^.Success /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="Background" Value="{DynamicResource ToggleButtonWarningIndeterminateBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminateBorderBrush}" />
<Style Selector="^.Warning /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Background" Value="{DynamicResource ToggleButtonDangerIndeterminateBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminateBorderBrush}" />
<Style Selector="^.Danger /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverForeground}" />
<Style Selector="^.Primary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonSuccessIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonWarningIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminatePointeroverBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDangerIndeterminatePointeroverForeground}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
<Style Selector="^.Primary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedForeground}" />
</Style>
<Style Selector="^.Secondary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePressedForeground}" />
</Style>
<Style Selector="^.Tertiary">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePressedForeground}" />
</Style>
<Style Selector="^.Success">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonSuccessIndeterminatePressedForeground}" />
</Style>
<Style Selector="^.Warning">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonWarningIndeterminatePressedForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminatePressedBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDangerIndeterminatePressedForeground}" />
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonIndeterminateDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDisabledForeground}" />
<Style Selector="^:checked">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonCheckedDisabledForeground}" />
</Style>
</Style>
<Style Selector="^.Large">
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,75 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="ToggleButtonDefaultBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="ToggleButtonDefaultPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="ToggleButtonDefaultPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonDefaultDisabledForeground" ResourceKey="SemiColorDisabledText" />
<StaticResource x:Key="ToggleButtonCheckedDisabledForeground" ResourceKey="SemiColorDisabledText" />
<SolidColorBrush x:Key="ToggleButtonDefaultBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonDefaultPrimaryForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ToggleButtonDefaultSecondaryForeground" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonDefaultTertiaryForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="ToggleButtonDefaultSuccessForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonDefaultWarningForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDefaultDangerForeground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedBackground" ResourceKey="SemiColorPrimary" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedBackground" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedBackground" ResourceKey="SemiColorTertiary" />
<StaticResource x:Key="ToggleButtonSuccessCheckedBackground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonWarningCheckedBackground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDangerCheckedBackground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPointeroverBackground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedPointeroverBackground" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedPointeroverBackground" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessCheckedPointeroverBackground" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningCheckedPointeroverBackground" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerCheckedPointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedBackground" ResourceKey="SemiColorPrimaryActive" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedPressedBackground" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedPressedBackground" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessCheckedPressedBackground" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningCheckedPressedBackground" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerCheckedPressedBackground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonCheckedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ToggleButtonCheckedDisabledBackground" ResourceKey="SemiColorDisabledBackground" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminateBackground" ResourceKey="SemiColorSecondaryLight" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminateBackground" ResourceKey="SemiColorTertiaryLight" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminateBackground" ResourceKey="SemiColorSuccessLight" />
<StaticResource x:Key="ToggleButtonWarningIndeterminateBackground" ResourceKey="SemiColorWarningLight" />
<StaticResource x:Key="ToggleButtonDangerIndeterminateBackground" ResourceKey="SemiColorDangerLight" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBorderBrush" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminateBorderBrush" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminateBorderBrush" ResourceKey="SemiColorText1" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminateBorderBrush" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonWarningIndeterminateBorderBrush" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDangerIndeterminateBorderBrush" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverForeground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePointeroverForeground" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePointeroverForeground" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePointeroverForeground" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePointeroverForeground" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePointeroverForeground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePressedBorderBrush" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePressedBorderBrush" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePressedBorderBrush" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedForeground" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePressedForeground" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePressedForeground" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePressedForeground" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePressedForeground" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePressedForeground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonIndeterminateDisabledBorderBrush" ResourceKey="SemiColorDisabledText" />
</ResourceDictionary>

View File

@@ -1,30 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="ToggleButtonDefaultBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonDefaultPointeroverBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="ToggleButtonDefaultPressedBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="ToggleButtonDefaultDisabledBorderBrush" ResourceKey="SemiColorGrayText" />
<StaticResource x:Key="ToggleButtonDefaultDisabledForeground" ResourceKey="SemiColorGrayText" />
<StaticResource x:Key="ToggleButtonCheckedDisabledForeground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonDefaultBorderBrush" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="ToggleButtonDefaultPrimaryForeground" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedBackground" ResourceKey="SemiColorHighlight" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPointeroverBackground" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedForeground" ResourceKey="SemiColorHighlight" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonSuccessCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonWarningCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonDangerCheckedPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" ResourceKey="SemiColorHighlight" />
<StaticResource x:Key="ToggleButtonCheckedForeground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="ToggleButtonCheckedDisabledBackground" ResourceKey="SemiColorGrayText" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBorderBrush" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverForeground" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedForeground" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="ToggleButtonIndeterminateDisabledBorderBrush" ResourceKey="SemiColorGrayText" />
</ResourceDictionary>

View File

@@ -1,75 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="ToggleButtonDefaultBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="ToggleButtonDefaultPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="ToggleButtonDefaultPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonDefaultDisabledForeground" ResourceKey="SemiColorDisabledText" />
<StaticResource x:Key="ToggleButtonCheckedDisabledForeground" ResourceKey="SemiColorDisabledText" />
<SolidColorBrush x:Key="ToggleButtonDefaultBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonDefaultPrimaryForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ToggleButtonDefaultSecondaryForeground" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonDefaultTertiaryForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="ToggleButtonDefaultSuccessForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonDefaultWarningForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDefaultDangerForeground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedBackground" ResourceKey="SemiColorPrimary" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedBackground" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedBackground" ResourceKey="SemiColorTertiary" />
<StaticResource x:Key="ToggleButtonSuccessCheckedBackground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonWarningCheckedBackground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDangerCheckedBackground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPointeroverBackground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedPointeroverBackground" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedPointeroverBackground" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessCheckedPointeroverBackground" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningCheckedPointeroverBackground" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerCheckedPointeroverBackground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ToggleButtonPrimaryCheckedPressedBackground" ResourceKey="SemiColorPrimaryActive" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" Color="Transparent" />
<StaticResource x:Key="ToggleButtonSecondaryCheckedPressedBackground" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryCheckedPressedBackground" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessCheckedPressedBackground" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningCheckedPressedBackground" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerCheckedPressedBackground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonCheckedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ToggleButtonCheckedDisabledBackground" ResourceKey="SemiColorDisabledBackground" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminateBackground" ResourceKey="SemiColorSecondaryLight" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminateBackground" ResourceKey="SemiColorTertiaryLight" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminateBackground" ResourceKey="SemiColorSuccessLight" />
<StaticResource x:Key="ToggleButtonWarningIndeterminateBackground" ResourceKey="SemiColorWarningLight" />
<StaticResource x:Key="ToggleButtonDangerIndeterminateBackground" ResourceKey="SemiColorDangerLight" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminateBorderBrush" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminateBorderBrush" ResourceKey="SemiColorSecondary" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminateBorderBrush" ResourceKey="SemiColorText1" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminateBorderBrush" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ToggleButtonWarningIndeterminateBorderBrush" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ToggleButtonDangerIndeterminateBorderBrush" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePointeroverBorderBrush" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePointeroverForeground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePointeroverForeground" ResourceKey="SemiColorSecondaryPointerover" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePointeroverForeground" ResourceKey="SemiColorTertiaryPointerover" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePointeroverForeground" ResourceKey="SemiColorSuccessPointerover" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePointeroverForeground" ResourceKey="SemiColorWarningPointerover" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePointeroverForeground" ResourceKey="SemiColorDangerPointerover" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePressedBorderBrush" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePressedBorderBrush" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePressedBorderBrush" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePressedBorderBrush" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonPrimaryIndeterminatePressedForeground" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ToggleButtonSecondaryIndeterminatePressedForeground" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="ToggleButtonTertiaryIndeterminatePressedForeground" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="ToggleButtonSuccessIndeterminatePressedForeground" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="ToggleButtonWarningIndeterminatePressedForeground" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="ToggleButtonDangerIndeterminatePressedForeground" ResourceKey="SemiColorDangerActive" />
<StaticResource x:Key="ToggleButtonIndeterminateDisabledBorderBrush" ResourceKey="SemiColorDisabledText" />
</ResourceDictionary>