From 986d49c2d96fa51e9038e31bb451c871c06e1365 Mon Sep 17 00:00:00 2001 From: excelsior <356647124@qq.com> Date: Fri, 13 Nov 2026 13:50:25 +0800 Subject: [PATCH 1/2] feat: add Tag option to control Expander header text orientation Co-authored-by: sisyphus-dev-ai --- .../Themes/Styles/Base/ExpanderBaseStyle.xaml | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml index 8412b1f3..7b08c31d 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml @@ -19,7 +19,7 @@ - + @@ -34,6 +34,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -84,7 +105,7 @@ - + @@ -99,6 +120,27 @@ + + + + + + + + + + + + + + + + + + + + + From 2d6c4c3f1cc1985028e2f1b536e8678b0683eb0d Mon Sep 17 00:00:00 2001 From: excelsior <356647124@qq.com> Date: Fri, 13 Nov 2026 16:33:29 +0800 Subject: [PATCH 2/2] refactor: use attached property ExpanderElement.HeaderTextOrientation instead of Tag Co-authored-by: sisyphus-dev-ai --- .../Controls/Attach/ExpanderElement.cs | 37 +++++++++++++++++++ .../HandyControl_Shared.projitems | 1 + .../Themes/Styles/Base/ExpanderBaseStyle.xaml | 8 ++-- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 src/Shared/HandyControl_Shared/Controls/Attach/ExpanderElement.cs diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/ExpanderElement.cs b/src/Shared/HandyControl_Shared/Controls/Attach/ExpanderElement.cs new file mode 100644 index 00000000..05b76f1e --- /dev/null +++ b/src/Shared/HandyControl_Shared/Controls/Attach/ExpanderElement.cs @@ -0,0 +1,37 @@ +using System.Windows; + +namespace HandyControl.Controls; + +/// +/// Header text orientation of an when is Left or Right. +/// +public enum ExpanderHeaderTextOrientation +{ + /// + /// Same as the current behavior: the whole header is rotated -90 degrees (glyphs lying on their side). + /// + Default = 0, + + /// + /// Upright vertical: characters stand upright and stack top-to-bottom. + /// + Vertical = 1, + + /// + /// Upright horizontal: a single horizontal line. + /// + Horizontal = 2 +} + +/// +/// Attached properties for . +/// +public class ExpanderElement +{ + public static readonly DependencyProperty HeaderTextOrientationProperty = DependencyProperty.RegisterAttached( + "HeaderTextOrientation", typeof(ExpanderHeaderTextOrientation), typeof(ExpanderElement), new FrameworkPropertyMetadata(ExpanderHeaderTextOrientation.Default)); + + public static void SetHeaderTextOrientation(DependencyObject element, ExpanderHeaderTextOrientation value) => element.SetValue(HeaderTextOrientationProperty, value); + + public static ExpanderHeaderTextOrientation GetHeaderTextOrientation(DependencyObject element) => (ExpanderHeaderTextOrientation) element.GetValue(HeaderTextOrientationProperty); +} diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems index 2f1732d9..47744c2e 100644 --- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems +++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems @@ -15,6 +15,7 @@ + diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml index 7b08c31d..139f2ec2 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml @@ -34,7 +34,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -134,7 +134,7 @@ - +