feat: RepeatButton & ToggleButton.

This commit is contained in:
Zhang Dian 2024-09-30 14:24:20 +08:00
parent 4728553ed8
commit aa17c2210d
5 changed files with 32 additions and 9 deletions

View File

@ -108,6 +108,7 @@
<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>
@ -123,6 +124,7 @@
<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>
@ -204,9 +206,9 @@
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidDisabledForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDisabledBorderBrush}" />
</Style>
</ControlTheme>
@ -247,12 +249,12 @@
BasedOn="{StaticResource {x:Type RepeatButton}}"
TargetType="RepeatButton">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>

View File

@ -98,6 +98,7 @@
<Style Selector="^:checked">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonCheckedForeground}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryCheckedBorderBrush}" />
<Style Selector="^.Primary">
<Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
</Style>
@ -138,9 +139,12 @@
</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}" />
@ -256,6 +260,9 @@
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDisabledForeground}" />
<Style Selector="^:checked">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonCheckedDisabledForeground}" />
</Style>
</Style>
<Style Selector="^.Large">

View File

@ -4,6 +4,7 @@
<SolidColorBrush x:Key="ToggleButtonDefaultPressedBackground" Opacity="0.20" Color="White" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledForeground" Opacity="0.35" Color="#F9F9F9" />
<SolidColorBrush x:Key="ToggleButtonCheckedDisabledForeground" Opacity="0.35" Color="#F9F9F9" />
<SolidColorBrush x:Key="ToggleButtonDefaultBorderBrush" Color="Transparent" />
@ -15,6 +16,7 @@
<SolidColorBrush x:Key="ToggleButtonDefaultDangerForeground" Color="#FC725A" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBackground" Color="#54A9FF" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonSecondaryCheckedBackground" Color="#40B4F3" />
<SolidColorBrush x:Key="ToggleButtonTertiaryCheckedBackground" Color="#888D92" />
<SolidColorBrush x:Key="ToggleButtonSuccessCheckedBackground" Color="#5DC264" />
@ -28,7 +30,9 @@
<SolidColorBrush x:Key="ToggleButtonWarningCheckedPointeroverBackground" Color="#FFC772" />
<SolidColorBrush x:Key="ToggleButtonDangerCheckedPointeroverBackground" Color="#FD9983" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBackground" Color="#A9D7FF" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonSecondaryCheckedPressedBackground" Color="#9DDCF9" />
<SolidColorBrush x:Key="ToggleButtonTertiaryCheckedPressedBackground" Color="#C6CACD" />
<SolidColorBrush x:Key="ToggleButtonSuccessCheckedPressedBackground" Color="#A6E1A8" />

View File

@ -511,6 +511,7 @@
<SolidColorBrush x:Key="ToggleButtonDefaultPressedBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledBorderBrush" Color="{StaticResource GrayTextColor}" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledForeground" Color="{StaticResource GrayTextColor}" />
<SolidColorBrush x:Key="ToggleButtonCheckedDisabledForeground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonDefaultBorderBrush" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ToggleButtonDefaultPrimaryForeground" Color="{StaticResource ButtonTextColor}" />
@ -519,14 +520,19 @@
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPointeroverBackground" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedForeground" Color="{StaticResource HighlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonSecondaryCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonTertiaryCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonSuccessCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonWarningCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonDangerCheckedPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" Color="{StaticResource HighlightColor}" />
<SolidColorBrush x:Key="ToggleButtonCheckedForeground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ToggleButtonCheckedDisabledBackground" Color="{StaticResource GrayTextColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminateBackground" Color="{StaticResource HotlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminateBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminateBorderBrush" Color="{StaticResource HotlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePointeroverBorderBrush" Color="{StaticResource HighlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePointeroverForeground" Color="{StaticResource HotlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePointeroverBorderBrush" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePointeroverForeground" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePressedBorderBrush" Color="{StaticResource HotlightColor}" />
<SolidColorBrush x:Key="ToggleButtonPrimaryIndeterminatePressedForeground" Color="{StaticResource HotlightColor}" />
<SolidColorBrush x:Key="ToggleButtonIndeterminateDisabledBorderBrush" Color="{StaticResource GrayTextColor}" />

View File

@ -4,6 +4,7 @@
<SolidColorBrush x:Key="ToggleButtonDefaultPressedBackground" Opacity="0.13" Color="#2E3238" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonDefaultDisabledForeground" Opacity="0.35" Color="#1C1F23" />
<SolidColorBrush x:Key="ToggleButtonCheckedDisabledForeground" Opacity="0.35" Color="#1C1F23" />
<SolidColorBrush x:Key="ToggleButtonDefaultBorderBrush" Color="Transparent" />
@ -15,6 +16,7 @@
<SolidColorBrush x:Key="ToggleButtonDefaultDangerForeground" Color="#F93920" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBackground" Color="#0077FA" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonSecondaryCheckedBackground" Color="#0095EE" />
<SolidColorBrush x:Key="ToggleButtonTertiaryCheckedBackground" Color="#6B7075" />
<SolidColorBrush x:Key="ToggleButtonSuccessCheckedBackground" Color="#3BB346" />
@ -28,7 +30,9 @@
<SolidColorBrush x:Key="ToggleButtonWarningCheckedPointeroverBackground" Color="#D26700" />
<SolidColorBrush x:Key="ToggleButtonDangerCheckedPointeroverBackground" Color="#D52515" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedForeground" Color="White" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBackground" Color="#004FB3" />
<SolidColorBrush x:Key="ToggleButtonPrimaryCheckedPressedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ToggleButtonSecondaryCheckedPressedBackground" Color="#0063A7" />
<SolidColorBrush x:Key="ToggleButtonTertiaryCheckedPressedBackground" Color="#41464C" />
<SolidColorBrush x:Key="ToggleButtonSuccessCheckedPressedBackground" Color="#25772F" />