feat: ButtonSpinner.

This commit is contained in:
Zhang Dian 2024-09-27 16:56:06 +08:00
parent 72ccb80e5f
commit 3e5fa9d5bf
5 changed files with 18 additions and 11 deletions

View File

@ -113,6 +113,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>

View File

@ -8,9 +8,9 @@
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="ButtonSpinnerRepeatButton" TargetType="RepeatButton">
<Setter Property="RepeatButton.Background" Value="{DynamicResource ButtonSpinnerRepeatButtonBackground}" />
<Setter Property="RepeatButton.Cursor" Value="Hand" />
<Setter Property="RepeatButton.Template">
<Setter Property="Background" Value="{DynamicResource ButtonSpinnerRepeatButtonBackground}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter
x:Name="PART_ContentPresenter"
@ -38,10 +38,10 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type ButtonSpinner}" TargetType="ButtonSpinner">
<Setter Property="ButtonSpinner.BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}" />
<Setter Property="ButtonSpinner.BorderThickness" Value="0" />
<Setter Property="ButtonSpinner.MinWidth" Value="300" />
<Setter Property="ButtonSpinner.Template">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="MinWidth" Value="300" />
<Setter Property="Template">
<ControlTemplate TargetType="ButtonSpinner">
<Grid ColumnDefinitions="Auto, *, Auto">
<Border
@ -97,5 +97,8 @@
<Setter Property="Grid.Column" Value="0" />
<Setter Property="Margin" Value="0 0 4 0" />
</Style>
<Style Selector="^:pointerover /template/ Border#ButtonGroup">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonPointeroverBorderBrush}"/>
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonBackground" Color="#35363C" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBackground" Opacity="0.12" Color="White" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPressedBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonDisabledBackground" Opacity="0.04" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonForeground" Opacity="0.6" Color="#F9F9F9" />

View File

@ -47,7 +47,7 @@
<!-- Outline -->
<SolidColorBrush x:Key="ButtonOutlineBackground" Color="Transparent" />
<SolidColorBrush x:Key="ButtonOutlineBorderBrush" Color="{StaticResource WindowTextColor}" />
<SolidColorBrush x:Key="ButtonOutlinePointeroverBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ButtonOutlinePointeroverBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ButtonOutlinePressedBackground" Color="{StaticResource WindowColor}" />
<!-- end Outline -->
@ -57,9 +57,10 @@
<!-- ButtonSpinner -->
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonBackground" Color="{StaticResource ButtonFaceColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonDisabledBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBorderBrush" Color="{StaticResource HighlightColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPressedBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonDisabledBackground" Color="{StaticResource GrayTextColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonForeground" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonBorderBrush" Color="{StaticResource ButtonTextColor}" />

View File

@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonBackground" Color="White" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPointeroverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonPressedBackground" Opacity="0.13" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonDisabledBackground" Opacity="0.05" Color="#2E3238" />
<SolidColorBrush x:Key="ButtonSpinnerRepeatButtonForeground" Opacity="0.62" Color="#1C1F23" />