feat: :disabled, Tertiary Classes Button color.

This commit is contained in:
Zhang Dian 2024-07-14 23:49:30 +08:00
parent 6a94e403c9
commit 0979141f54
6 changed files with 29 additions and 16 deletions

View File

@ -89,6 +89,13 @@
Disabled
</Button>
</StackPanel>
<TextBlock>Disabled</TextBlock>
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<Button IsEnabled="False">Light</Button>
<Button IsEnabled="False" Theme="{DynamicResource SolidButton}">Solid</Button>
<Button IsEnabled="False" Theme="{DynamicResource OutlineButton}">Outline</Button>
<Button IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Borderless</Button>
</StackPanel>
<TextBlock>DropDownButton</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="8">
@ -155,6 +162,12 @@
<ToggleSplitButton Classes="Danger" Content="Danger" />
<ToggleSplitButton Classes="Danger" Content="Disabled" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSplitButton Content="Default" Classes="Success" />
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" />
<ToggleSplitButton Content="Default" Classes="Success" IsEnabled="False" />
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSplitButton Classes="Small" Content="Small" />
<ToggleSplitButton Content="Default" />

View File

@ -2,9 +2,9 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<!-- Button Theme Key: Solid Light Border Borderless; Default is Light -->
<!-- Button Default Classes: Primary Secondary, Tertiary, Warning, Danger; Default is Primary -->
<!-- State default pointerover pressed disabled -->
<!-- Button Theme Key: Light, Solid, Outline, Borderless; Default is Light -->
<!-- Button Default Classes: Primary, Secondary, Tertiary, Success, Warning, Danger; Default is Primary -->
<!-- State: default, pointerover, pressed, disabled -->
<!-- Button Light -->
<ControlTheme x:Key="{x:Type Button}" TargetType="Button">
@ -85,7 +85,6 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
@ -104,9 +103,9 @@
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Button.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Button.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="Button.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
<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">
@ -211,7 +210,7 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>

View File

@ -110,7 +110,6 @@
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
</Style>
<Style Selector="^.Large">
@ -232,7 +231,7 @@
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />

View File

@ -218,7 +218,7 @@
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
</Style>
<Style Selector="^:disabled /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
@ -301,7 +301,7 @@
</Style>
<Style Selector="^:disabled /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>

View File

@ -2,7 +2,7 @@
<!-- Light -->
<SolidColorBrush x:Key="ButtonDefaultPrimaryForeground" Color="#54A9FF" />
<SolidColorBrush x:Key="ButtonDefaultSecondaryForeground" Color="#40B4F3" />
<SolidColorBrush x:Key="ButtonDefaultTertiaryForeground" Color="#888D92" />
<SolidColorBrush x:Key="ButtonDefaultTertiaryForeground" Opacity="0.8" Color="#F9F9F9" />
<SolidColorBrush x:Key="ButtonDefaultSuccessForeground" Color="#5DC264" />
<SolidColorBrush x:Key="ButtonDefaultWarningForeground" Color="#FFAE43" />
<SolidColorBrush x:Key="ButtonDefaultDangerForeground" Color="#FC725A" />
@ -11,7 +11,6 @@
<SolidColorBrush x:Key="ButtonDefaultBackground" Opacity="0.12" Color="White" />
<SolidColorBrush x:Key="ButtonDefaultPointeroverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="ButtonDefaultPressedBackground" Opacity="0.20" Color="White" />
<SolidColorBrush x:Key="ButtonDefaultDisabledBackground" Opacity="0.04" Color="#E6E8EA" />
<SolidColorBrush x:Key="ButtonDefaultBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ButtonDefaultPointeroverBorderBrush" Color="Transparent" />
@ -69,6 +68,8 @@
<SolidColorBrush x:Key="ButtonSolidDangerBorderBrush" Color="#FC725A" />
<SolidColorBrush x:Key="ButtonSolidDangerPointeroverBorderBrush" Color="#FD9983" />
<SolidColorBrush x:Key="ButtonSolidDangerPressedBorderBrush" Color="#FDBEAC" />
<SolidColorBrush x:Key="ButtonSolidDisabledBackground" Color="#2E3238" />
<!-- end Solid -->
<!-- Outline -->

View File

@ -2,7 +2,7 @@
<!-- Light -->
<SolidColorBrush x:Key="ButtonDefaultPrimaryForeground" Color="#0077FA" />
<SolidColorBrush x:Key="ButtonDefaultSecondaryForeground" Color="#0095EE" />
<SolidColorBrush x:Key="ButtonDefaultTertiaryForeground" Color="#6B7075" />
<SolidColorBrush x:Key="ButtonDefaultTertiaryForeground" Opacity="0.8" Color="#1C1F23" />
<SolidColorBrush x:Key="ButtonDefaultSuccessForeground" Color="#3BB346" />
<SolidColorBrush x:Key="ButtonDefaultWarningForeground" Color="#FC8800" />
<SolidColorBrush x:Key="ButtonDefaultDangerForeground" Color="#F93920" />
@ -11,7 +11,6 @@
<SolidColorBrush x:Key="ButtonDefaultBackground" Opacity="0.05" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonDefaultPointeroverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonDefaultPressedBackground" Opacity="0.13" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonDefaultDisabledBackground" Color="#E6E8EA" />
<SolidColorBrush x:Key="ButtonDefaultBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ButtonDefaultPointeroverBorderBrush" Color="Transparent" />
@ -69,6 +68,8 @@
<SolidColorBrush x:Key="ButtonSolidDangerBorderBrush" Color="#F93920" />
<SolidColorBrush x:Key="ButtonSolidDangerPointeroverBorderBrush" Color="#D52515" />
<SolidColorBrush x:Key="ButtonSolidDangerPressedBorderBrush" Color="#B2140C" />
<SolidColorBrush x:Key="ButtonSolidDisabledBackground" Color="#E6E8EA" />
<!-- end Solid -->
<!-- Outline -->