66using System . Windows . Controls . Primitives ;
77using System . Windows . Media ;
88using System . Windows . Threading ;
9+ using Wpf . Ui . Controls ;
910
10- namespace Wpf . Ui . Violeta . Hotfix ;
11+ namespace Wpf . Ui . Violeta . Controls ;
1112
1213/// <summary>
13- /// WinUI-style Slider AutoToolTip placement and Fluent style attachment for Hotfix Slider .
14+ /// WinUI-style Slider AutoToolTip placement and Fluent style attachment.
1415/// </summary>
15- public static class SliderAutoToolTipHelper
16+ public static class SliderHelper
1617{
1718 private const string AutoToolTipStyleKey = "SliderAutoToolTipStyle" ;
1819
@@ -35,7 +36,7 @@ public static void SetAttach(Thumb thumb, bool value)
3536 DependencyProperty . RegisterAttached (
3637 "Attach" ,
3738 typeof ( bool ) ,
38- typeof ( SliderAutoToolTipHelper ) ,
39+ typeof ( SliderHelper ) ,
3940 new PropertyMetadata ( false , OnAttachChanged ) ) ;
4041
4142 private static void OnAttachChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
@@ -89,52 +90,6 @@ private static void ApplyFluentStyle(ToolTip toolTip, FrameworkElement resourceH
8990
9091 #endregion Attach
9192
92- #region Prefix / Suffix
93-
94- /// <summary>
95- /// Optional text prepended to the AutoToolTip value, e.g. "Volume: ".
96- /// Attach to the <see cref="Slider"/> (or to the ToolTip itself).
97- /// </summary>
98- public static string ? GetPrefix ( DependencyObject element )
99- {
100- return ( string ? ) element . GetValue ( PrefixProperty ) ;
101- }
102-
103- public static void SetPrefix ( DependencyObject element , string ? value )
104- {
105- element . SetValue ( PrefixProperty , value ) ;
106- }
107-
108- public static readonly DependencyProperty PrefixProperty =
109- DependencyProperty . RegisterAttached (
110- "Prefix" ,
111- typeof ( string ) ,
112- typeof ( SliderAutoToolTipHelper ) ,
113- new PropertyMetadata ( null ) ) ;
114-
115- /// <summary>
116- /// Optional text appended to the AutoToolTip value, e.g. "%".
117- /// Attach to the <see cref="Slider"/> (or to the ToolTip itself).
118- /// </summary>
119- public static string ? GetSuffix ( DependencyObject element )
120- {
121- return ( string ? ) element . GetValue ( SuffixProperty ) ;
122- }
123-
124- public static void SetSuffix ( DependencyObject element , string ? value )
125- {
126- element . SetValue ( SuffixProperty , value ) ;
127- }
128-
129- public static readonly DependencyProperty SuffixProperty =
130- DependencyProperty . RegisterAttached (
131- "Suffix" ,
132- typeof ( string ) ,
133- typeof ( SliderAutoToolTipHelper ) ,
134- new PropertyMetadata ( null ) ) ;
135-
136- #endregion Prefix / Suffix
137-
13893 #region IsEnabled
13994
14095 public static bool GetIsEnabled ( ToolTip toolTip )
@@ -151,7 +106,7 @@ public static void SetIsEnabled(ToolTip toolTip, bool value)
151106 DependencyProperty . RegisterAttached (
152107 "IsEnabled" ,
153108 typeof ( bool ) ,
154- typeof ( SliderAutoToolTipHelper ) ,
109+ typeof ( SliderHelper ) ,
155110 new PropertyMetadata ( OnIsEnabledChanged ) ) ;
156111
157112 private static void OnIsEnabledChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
@@ -231,8 +186,8 @@ thumb.TemplatedParent is not Slider slider ||
231186 }
232187
233188 // When attached to the ToolTip itself, honor the local value over the slider's.
234- string ? prefix = GetPrefix ( toolTip ) ?? GetPrefix ( slider ) ;
235- string ? suffix = GetSuffix ( toolTip ) ?? GetSuffix ( slider ) ;
189+ string ? prefix = ControlHelper . GetPrefix ( toolTip ) ?? ControlHelper . GetPrefix ( slider ) ;
190+ string ? suffix = ControlHelper . GetSuffix ( toolTip ) ?? ControlHelper . GetSuffix ( slider ) ;
236191
237192 if ( string . IsNullOrEmpty ( prefix ) && string . IsNullOrEmpty ( suffix ) )
238193 {
@@ -260,7 +215,7 @@ thumb.TemplatedParent is not Slider slider ||
260215 DependencyProperty . RegisterAttached (
261216 "IsFormattingContent" ,
262217 typeof ( bool ) ,
263- typeof ( SliderAutoToolTipHelper ) ) ;
218+ typeof ( SliderHelper ) ) ;
264219
265220 private static bool GetIsFormattingContent ( ToolTip toolTip )
266221 {
@@ -280,7 +235,7 @@ private static void SetIsFormattingContent(ToolTip toolTip, bool value)
280235 DependencyProperty . RegisterAttached (
281236 "OriginalCustomPopupPlacementCallback" ,
282237 typeof ( CustomPopupPlacementCallback ) ,
283- typeof ( SliderAutoToolTipHelper ) ) ;
238+ typeof ( SliderHelper ) ) ;
284239
285240 private static CustomPopupPlacementCallback GetOriginalCustomPopupPlacementCallback ( ToolTip toolTip )
286241 {
0 commit comments