From 37d69e19066cdfe0752eaca021f9ffebf9d2ca7a Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Sun, 22 Jan 2023 22:23:02 +0800
Subject: [PATCH] chore: add show label property for toggle button.
---
.../Styles/ToggleButtonDemoCtl.xaml | 8 ++
.../Controls/Attach/ToggleButtonAttach.cs | 14 +++
.../HandyControl_Shared.projitems | 1 +
.../Styles/Base/ToggleButtonBaseStyle.xaml | 93 ++++++++-----------
.../Themes/Styles/ToggleButton.xaml | 4 +-
5 files changed, 63 insertions(+), 57 deletions(-)
create mode 100644 src/Shared/HandyControl_Shared/Controls/Attach/ToggleButtonAttach.cs
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
index 75053cb3..e99b67d8 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
@@ -118,6 +118,10 @@
+
+
+
+
@@ -230,6 +234,10 @@
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/ToggleButtonAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/ToggleButtonAttach.cs
new file mode 100644
index 00000000..66bd9a1d
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/ToggleButtonAttach.cs
@@ -0,0 +1,14 @@
+using HandyControl.Data;
+using System.Windows;
+
+namespace HandyControl.Controls;
+
+public class ToggleButtonAttach
+{
+ public static readonly DependencyProperty ShowLabelProperty = DependencyProperty.RegisterAttached(
+ "ShowLabel", typeof(bool), typeof(ToggleButtonAttach), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
+
+ public static void SetShowLabel(DependencyObject element, bool value) => element.SetValue(ShowLabelProperty, ValueBoxes.BooleanBox(value));
+
+ public static bool GetShowLabel(DependencyObject element) => (bool) element.GetValue(ShowLabelProperty);
+}
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index d6a57cce..7f7b0a00 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -29,6 +29,7 @@
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
index f0dd111d..918d51d4 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
@@ -105,97 +105,80 @@
+
-
-
-
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
index 0fd511ff..caae4534 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
@@ -196,8 +196,8 @@
-
-
+
+