From 663bfe70ce1b244bbbff82d5999c8b6049588eef Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Fri, 24 Jan 2025 20:31:52 +0800
Subject: [PATCH] feat: redesign IconButton.
---
.../Controls/IconButton.axaml | 106 ++++++++----------
.../Themes/Shared/IconButton.axaml | 3 +
.../Themes/Shared/_index.axaml | 1 +
src/Ursa/Controls/Buttons/IconButton.cs | 39 +++++--
4 files changed, 79 insertions(+), 70 deletions(-)
create mode 100644 src/Ursa.Themes.Semi/Themes/Shared/IconButton.axaml
diff --git a/src/Ursa.Themes.Semi/Controls/IconButton.axaml b/src/Ursa.Themes.Semi/Controls/IconButton.axaml
index accf538..91c12b5 100644
--- a/src/Ursa.Themes.Semi/Controls/IconButton.axaml
+++ b/src/Ursa.Themes.Semi/Controls/IconButton.axaml
@@ -3,7 +3,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa">
-
+
+
+
+
+
+
@@ -31,14 +40,13 @@
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="{TemplateBinding FontWeight}"
UseLayoutRounding="False">
-
-
+ Orientation="Horizontal"
+ Spacing="{StaticResource IconButtonInnerSpacing}">
+
@@ -51,7 +59,16 @@
+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+ Opacity="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=!IsLoading, Converter={StaticResource OpacityConverter}}">
+
+
+
+
+
+
-
+
@@ -107,67 +122,41 @@
-
-
-
-
+
-
-
+
-
-
-
-
-
-
+
+
+
+
-
-
+
-
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Themes/Shared/IconButton.axaml b/src/Ursa.Themes.Semi/Themes/Shared/IconButton.axaml
new file mode 100644
index 0000000..48b153b
--- /dev/null
+++ b/src/Ursa.Themes.Semi/Themes/Shared/IconButton.axaml
@@ -0,0 +1,3 @@
+
+ 8
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml b/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml
index 9d1bb41..9d42c27 100644
--- a/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml
+++ b/src/Ursa.Themes.Semi/Themes/Shared/_index.axaml
@@ -11,6 +11,7 @@
+
diff --git a/src/Ursa/Controls/Buttons/IconButton.cs b/src/Ursa/Controls/Buttons/IconButton.cs
index 68b1e26..36c2aeb 100644
--- a/src/Ursa/Controls/Buttons/IconButton.cs
+++ b/src/Ursa/Controls/Buttons/IconButton.cs
@@ -7,17 +7,22 @@ using Ursa.Common;
namespace Ursa.Controls;
-[PseudoClasses(PC_Right, PC_Left, PC_Top, PC_Bottom, PC_Empty)]
-public class IconButton: Button
+[TemplatePart(PART_RootPanel, typeof(Panel))]
+[PseudoClasses(PC_Right, PC_Left, PC_Top, PC_Bottom, PC_Empty, PC_EmptyContent)]
+public class IconButton : Button
{
public const string PC_Right = ":right";
public const string PC_Left = ":left";
public const string PC_Top = ":top";
public const string PC_Bottom = ":bottom";
public const string PC_Empty = ":empty";
-
- public static readonly StyledProperty