From 445b31893e471dd40b7e3822d32f2af84e2def35 Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Sun, 9 Nov 2025 11:26:49 +0800
Subject: [PATCH 1/2] feat: enhance button styles with AI Colorful classes and
update ButtonDemo layout.
---
.../Semi.Avalonia.Demo/Pages/ButtonDemo.axaml | 537 +++++++++++++-----
.../Pages/RepeatButtonDemo.axaml | 80 ---
.../Pages/RepeatButtonDemo.axaml.cs | 11 -
.../Pages/ToggleButtonDemo.axaml | 98 ----
.../Pages/ToggleButtonDemo.axaml.cs | 11 -
demo/Semi.Avalonia.Demo/Views/MainView.axaml | 6 -
src/Semi.Avalonia/Controls/Button.axaml | 142 ++++-
.../Controls/DropDownButton.axaml | 143 ++++-
src/Semi.Avalonia/Controls/SplitButton.axaml | 177 +++++-
src/Semi.Avalonia/Controls/ToggleButton.axaml | 116 +++-
src/Semi.Avalonia/Themes/Dark/Button.axaml | 16 +
src/Semi.Avalonia/Themes/Light/Button.axaml | 16 +
12 files changed, 948 insertions(+), 405 deletions(-)
delete mode 100644 demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml
delete mode 100644 demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml.cs
delete mode 100644 demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml
delete mode 100644 demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml.cs
diff --git a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml
index 72cc9df..e518737 100644
--- a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml
+++ b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml
@@ -6,174 +6,399 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Light (Default)
-
-
-
-
-
-
-
-
-
- Solid
-
-
-
-
-
-
-
-
-
- Outline
-
-
-
-
-
-
-
-
-
- Borderless
-
-
-
-
-
-
-
-
-
- Disabled
-
-
-
-
-
-
- Size Classes
-
-
-
-
-
+
+
+
+
+
+
+
+
- DropDownButton
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- SplitButton
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- ToggleSplitButton
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml
deleted file mode 100644
index a9045c9..0000000
--- a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
- Light (Default)
-
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
- Disabled
-
- Solid
-
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
-
- Disabled
-
-
- Outline
-
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
-
- Disabled
-
-
- Borderless
-
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
-
- Disabled
-
-
- Disabled
-
-
-
-
-
-
- Size Classes
-
- Small
- Default
- Large
-
-
-
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml.cs
deleted file mode 100644
index 3c0a63e..0000000
--- a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Avalonia.Controls;
-
-namespace Semi.Avalonia.Demo.Pages;
-
-public partial class RepeatButtonDemo : UserControl
-{
- public RepeatButtonDemo()
- {
- InitializeComponent();
- }
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml
deleted file mode 100644
index a954a7b..0000000
--- a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
- Default
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
- Disabled
-
-
-
- Default
- Primary
- Secondary
- Tertiary
- Success
- Warning
- Danger
-
- Disabled
-
-
-
-
- Default
-
- Primary
-
-
- Secondary
-
-
- Tertiary
-
-
- Success
-
-
- Warning
-
-
- Danger
-
-
- Disabled
-
-
-
-
- Default
- Checked
- Indeterminate
-
-
-
- Small
- Default
- Large
-
-
-
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml.cs
deleted file mode 100644
index 643ed31..0000000
--- a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Avalonia.Controls;
-
-namespace Semi.Avalonia.Demo.Pages;
-
-public partial class ToggleButtonDemo : UserControl
-{
- public ToggleButtonDemo()
- {
- InitializeComponent();
- }
-}
\ No newline at end of file
diff --git a/demo/Semi.Avalonia.Demo/Views/MainView.axaml b/demo/Semi.Avalonia.Demo/Views/MainView.axaml
index 639de3c..fa86d0c 100644
--- a/demo/Semi.Avalonia.Demo/Views/MainView.axaml
+++ b/demo/Semi.Avalonia.Demo/Views/MainView.axaml
@@ -161,15 +161,9 @@
-
-
-
-
-
-
diff --git a/src/Semi.Avalonia/Controls/Button.axaml b/src/Semi.Avalonia/Controls/Button.axaml
index 7218632..ad4c871 100644
--- a/src/Semi.Avalonia/Controls/Button.axaml
+++ b/src/Semi.Avalonia/Controls/Button.axaml
@@ -1,11 +1,97 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -68,6 +154,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/src/Semi.Avalonia/Controls/DropDownButton.axaml b/src/Semi.Avalonia/Controls/DropDownButton.axaml
index 2dfc3c0..befda5c 100644
--- a/src/Semi.Avalonia/Controls/DropDownButton.axaml
+++ b/src/Semi.Avalonia/Controls/DropDownButton.axaml
@@ -2,16 +2,90 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -36,13 +110,12 @@
Padding="{TemplateBinding Padding}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -277,6 +390,16 @@
+
+
+
+
diff --git a/src/Semi.Avalonia/Controls/SplitButton.axaml b/src/Semi.Avalonia/Controls/SplitButton.axaml
index cd4f1ba..0363b38 100644
--- a/src/Semi.Avalonia/Controls/SplitButton.axaml
+++ b/src/Semi.Avalonia/Controls/SplitButton.axaml
@@ -2,22 +2,89 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -148,6 +215,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -356,6 +497,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -497,14 +356,6 @@
-
-
-
-