From 6df8ea21015657adac75c4fbe06e2d6cb20bf413 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Tue, 19 Mar 2024 21:53:22 +0800 Subject: [PATCH 1/9] feat: implement background sizing, change alignments and min height according to the design. --- .../Semi.Avalonia.Demo/Pages/ButtonDemo.axaml | 231 ++++++++++-------- .../Pages/RepeatButtonDemo.axaml | 5 + .../Pages/ToggleButtonDemo.axaml | 64 ++++- src/Semi.Avalonia/Controls/Button.axaml | 36 +-- .../Controls/DropDownButton.axaml | 62 +++-- src/Semi.Avalonia/Controls/RepeatButton.axaml | 44 ++-- src/Semi.Avalonia/Controls/SplitButton.axaml | 152 ++++++------ src/Semi.Avalonia/Controls/ToggleButton.axaml | 36 +-- src/Semi.Avalonia/Themes/Shared/Button.axaml | 6 +- .../Themes/Shared/ToggleButton.axaml | 5 +- 10 files changed, 378 insertions(+), 263 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml index 4f94211..0ae513a 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml @@ -4,114 +4,129 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="450" - d:DesignWidth="800" mc:Ignorable="d"> - - Light (Default) - - - - - - - - + + + Light (Default) + + + + + + + + + + + + + + + Solid + + + + + + + + + + Borderless + + + + + + + + + + DropDownButton + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Solid - - - - - - - - - - Borderless - - - - - - - - - - DropDownButton - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml index 5bf1e7f..65fe844 100644 --- a/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/RepeatButtonDemo.axaml @@ -48,5 +48,10 @@ Danger + + Small + Default + Large + diff --git a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml index 5701f79..60e6019 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml @@ -28,18 +28,64 @@ Success Warning Danger - Danger + + Danger + - Default - Primary - Secondary - Tertiary - Success - Warning - Danger - Danger + Default + + Primary + + + Secondary + + + Tertiary + + + Success + + + Warning + + + Danger + + + Danger + + + + Small + Default + Large \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/Button.axaml b/src/Semi.Avalonia/Controls/Button.axaml index 594b759..570e7fb 100644 --- a/src/Semi.Avalonia/Controls/Button.axaml +++ b/src/Semi.Avalonia/Controls/Button.axaml @@ -8,27 +8,33 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/DropDownButton.axaml b/src/Semi.Avalonia/Controls/DropDownButton.axaml index c8bc667..6cc83ab 100644 --- a/src/Semi.Avalonia/Controls/DropDownButton.axaml +++ b/src/Semi.Avalonia/Controls/DropDownButton.axaml @@ -4,24 +4,30 @@ x:CompileBindings="True"> - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -87,9 +95,9 @@ x:Key="SolidRepeatButton" BasedOn="{StaticResource {x:Type RepeatButton}}" TargetType="RepeatButton"> - - - + + + @@ -117,12 +123,18 @@ - - + + diff --git a/src/Semi.Avalonia/Themes/Shared/Button.axaml b/src/Semi.Avalonia/Themes/Shared/Button.axaml index 0532163..5eeb288 100644 --- a/src/Semi.Avalonia/Themes/Shared/Button.axaml +++ b/src/Semi.Avalonia/Themes/Shared/Button.axaml @@ -1,10 +1,14 @@ 14 - 600 + Normal 12 6 16 10 6 2 + + 32 + 24 + 40 1 diff --git a/src/Semi.Avalonia/Themes/Shared/ToggleButton.axaml b/src/Semi.Avalonia/Themes/Shared/ToggleButton.axaml index 71237b0..d710794 100644 --- a/src/Semi.Avalonia/Themes/Shared/ToggleButton.axaml +++ b/src/Semi.Avalonia/Themes/Shared/ToggleButton.axaml @@ -1,8 +1,7 @@ 14 - 600 - - 12 6 + Normal + 1 3 \ No newline at end of file From 2470522209985d2703d50db2dd88c3935d5db521 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 20 Mar 2024 21:00:11 +0800 Subject: [PATCH 2/9] feat: make button color targets template part. --- src/Semi.Avalonia/Controls/Button.axaml | 82 +++++++++++++++---------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/src/Semi.Avalonia/Controls/Button.axaml b/src/Semi.Avalonia/Controls/Button.axaml index 570e7fb..0a89ec6 100644 --- a/src/Semi.Avalonia/Controls/Button.axaml +++ b/src/Semi.Avalonia/Controls/Button.axaml @@ -70,17 +70,17 @@ - - - - - + - + - + - - - + + - + - + - + - - @@ -166,11 +166,11 @@ - - @@ -181,11 +181,11 @@ - - @@ -196,17 +196,17 @@ - - - - - @@ -163,14 +163,14 @@ - - @@ -178,20 +178,20 @@ - - - + + + + + + + + @@ -82,20 +96,21 @@ - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - + - + - + - + - - - @@ -254,12 +234,13 @@ x:Key="BorderlessDropDownButton" BasedOn="{StaticResource {x:Type DropDownButton}}" TargetType="DropDownButton"> - - - + diff --git a/src/Semi.Avalonia/Controls/RepeatButton.axaml b/src/Semi.Avalonia/Controls/RepeatButton.axaml index 8882653..88e17d2 100644 --- a/src/Semi.Avalonia/Controls/RepeatButton.axaml +++ b/src/Semi.Avalonia/Controls/RepeatButton.axaml @@ -28,9 +28,7 @@ VerticalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" - Background="{TemplateBinding Background}" BackgroundSizing="{TemplateBinding BackgroundSizing}" - BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" @@ -45,6 +43,11 @@ + + + + + + @@ -101,26 +151,58 @@ + + + + + + + @@ -227,8 +310,10 @@ x:Key="BorderlessSplitButton" BasedOn="{StaticResource {x:Type SplitButton}}" TargetType="SplitButton"> - - + + + + + Light (Default) @@ -52,80 +79,66 @@ Danger + DropDownButton - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + SplitButton + + + + + + + + + + + + + + + + + ToggleSplitButton - - - - - - - - - - - - - - + + + + + + + @@ -134,4 +147,4 @@ - + \ No newline at end of file From 90fbd2a7e5a4638df3dd53c1984ab132623d8413 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Fri, 22 Mar 2024 20:09:05 +0800 Subject: [PATCH 7/9] fix: fix dropdown button solid foreground. --- src/Semi.Avalonia/Controls/DropDownButton.axaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Semi.Avalonia/Controls/DropDownButton.axaml b/src/Semi.Avalonia/Controls/DropDownButton.axaml index 180ee7b..c9dd99a 100644 --- a/src/Semi.Avalonia/Controls/DropDownButton.axaml +++ b/src/Semi.Avalonia/Controls/DropDownButton.axaml @@ -141,6 +141,7 @@ + Date: Fri, 22 Mar 2024 20:37:01 +0800 Subject: [PATCH 9/9] fix: demos of using Button. --- demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml | 13 +++++++------ demo/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml | 1 + .../Pages/ManagedFileChooserDemo.axaml | 5 +++++ .../Pages/NotificationDemo.axaml | 15 +++++++++++---- .../Pages/RepeatButtonDemo.axaml | 6 +++--- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml index 420d5f8..7d96547 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml @@ -56,12 +56,12 @@ - + Borderless @@ -71,12 +71,12 @@ - + @@ -90,7 +90,7 @@ @@ -123,13 +123,14 @@ - + + ToggleSplitButton diff --git a/demo/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml index c0960d3..65c18a2 100644 --- a/demo/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml @@ -10,6 +10,7 @@ + + + diff --git a/demo/Semi.Avalonia.Demo/Pages/NotificationDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/NotificationDemo.axaml index f4dcf01..dd3b7da 100644 --- a/demo/Semi.Avalonia.Demo/Pages/NotificationDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/NotificationDemo.axaml @@ -8,10 +8,17 @@ d:DesignWidth="800" mc:Ignorable="d"> + + + +