@@ -144,6 +144,80 @@ public static class TextFieldAssist
144
144
145
145
public static bool GetIncludeSpellingSuggestions ( TextBoxBase element ) => ( bool ) element . GetValue ( IncludeSpellingSuggestionsProperty ) ;
146
146
147
+ /// <summary>
148
+ /// SuffixText dependency property
149
+ /// </summary>
150
+ public static readonly DependencyProperty SuffixTextProperty = DependencyProperty . RegisterAttached (
151
+ "SuffixText" , typeof ( string ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( default ( string ? ) ) ) ;
152
+
153
+ public static void SetSuffixText ( DependencyObject element , string ? value )
154
+ => element . SetValue ( SuffixTextProperty , value ) ;
155
+
156
+ public static string ? GetSuffixText ( DependencyObject element )
157
+ => ( string ? ) element . GetValue ( SuffixTextProperty ) ;
158
+
159
+ /// <summary>
160
+ /// PrefixText dependency property
161
+ /// </summary>
162
+ public static readonly DependencyProperty PrefixTextProperty = DependencyProperty . RegisterAttached (
163
+ "PrefixText" , typeof ( string ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( default ( string ? ) ) ) ;
164
+
165
+ public static void SetPrefixText ( DependencyObject element , string ? value )
166
+ => element . SetValue ( PrefixTextProperty , value ) ;
167
+
168
+ public static string ? GetPrefixText ( DependencyObject element )
169
+ => ( string ? ) element . GetValue ( PrefixTextProperty ) ;
170
+
171
+ /// <summary>
172
+ /// Controls the visbility of the clear button.
173
+ /// </summary>
174
+ public static readonly DependencyProperty HasClearButtonProperty = DependencyProperty . RegisterAttached (
175
+ "HasClearButton" , typeof ( bool ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( false , HasClearButtonChanged ) ) ;
176
+
177
+ public static void SetHasClearButton ( DependencyObject element , bool value )
178
+ => element . SetValue ( HasClearButtonProperty , value ) ;
179
+
180
+ public static bool GetHasClearButton ( DependencyObject element )
181
+ => ( bool ) element . GetValue ( HasClearButtonProperty ) ;
182
+
183
+ /// <summary>
184
+ /// Controls visibility of the leading icon
185
+ /// </summary>
186
+ public static readonly DependencyProperty HasLeadingIconProperty = DependencyProperty . RegisterAttached (
187
+ "HasLeadingIcon" , typeof ( bool ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( default ( bool ) ) ) ;
188
+
189
+ public static void SetHasLeadingIcon ( DependencyObject element , bool value )
190
+ => element . SetValue ( HasLeadingIconProperty , value ) ;
191
+
192
+ public static bool GetHasLeadingIcon ( DependencyObject element )
193
+ => ( bool ) element . GetValue ( HasLeadingIconProperty ) ;
194
+
195
+ /// <summary>
196
+ /// Controls the leading icon
197
+ /// </summary>
198
+ public static readonly DependencyProperty LeadingIconProperty = DependencyProperty . RegisterAttached (
199
+ "LeadingIcon" , typeof ( PackIconKind ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( ) ) ;
200
+
201
+ public static void SetLeadingIcon ( DependencyObject element , PackIconKind value )
202
+ => element . SetValue ( LeadingIconProperty , value ) ;
203
+
204
+ public static PackIconKind GetLeadingIcon ( DependencyObject element )
205
+ => ( PackIconKind ) element . GetValue ( LeadingIconProperty ) ;
206
+
207
+ /// <summary>
208
+ /// Controls the size of the leading icon
209
+ /// </summary>
210
+ public static readonly DependencyProperty LeadingIconSizeProperty = DependencyProperty . RegisterAttached (
211
+ "LeadingIconSize" , typeof ( double ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( 20.0 ) ) ;
212
+
213
+ public static void SetLeadingIconSize ( DependencyObject element , double value )
214
+ => element . SetValue ( LeadingIconSizeProperty , value ) ;
215
+
216
+ public static double GetLeadingIconSize ( DependencyObject element )
217
+ => ( double ) element . GetValue ( LeadingIconSizeProperty ) ;
218
+
219
+ #region Methods
220
+
147
221
private static void IncludeSpellingSuggestionsChanged ( DependencyObject element , DependencyPropertyChangedEventArgs e )
148
222
{
149
223
if ( element is TextBoxBase textBox )
@@ -255,13 +329,7 @@ where ReferenceEquals(item.Tag, typeof(Spelling))
255
329
{
256
330
menu . Items . Remove ( item ) ;
257
331
}
258
- }
259
-
260
- /// <summary>
261
- /// Controls the visbility of the clear button.
262
- /// </summary>
263
- public static readonly DependencyProperty HasClearButtonProperty = DependencyProperty . RegisterAttached (
264
- "HasClearButton" , typeof ( bool ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( false , HasClearButtonChanged ) ) ;
332
+ }
265
333
266
334
private static void HasClearButtonChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
267
335
{
@@ -299,39 +367,7 @@ private static void SetClearHandler(Control box)
299
367
clearButton . Click -= handler ;
300
368
}
301
369
}
302
-
303
- public static void SetHasClearButton ( DependencyObject element , bool value )
304
- => element . SetValue ( HasClearButtonProperty , value ) ;
305
-
306
- public static bool GetHasClearButton ( DependencyObject element )
307
- => ( bool ) element . GetValue ( HasClearButtonProperty ) ;
308
-
309
- /// <summary>
310
- /// SuffixText dependency property
311
- /// </summary>
312
- public static readonly DependencyProperty SuffixTextProperty = DependencyProperty . RegisterAttached (
313
- "SuffixText" , typeof ( string ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( default ( string ? ) ) ) ;
314
-
315
- public static void SetSuffixText ( DependencyObject element , string ? value )
316
- => element . SetValue ( SuffixTextProperty , value ) ;
317
-
318
- public static string ? GetSuffixText ( DependencyObject element )
319
- => ( string ? ) element . GetValue ( SuffixTextProperty ) ;
320
-
321
- /// <summary>
322
- /// PrefixText dependency property
323
- /// </summary>
324
- public static readonly DependencyProperty PrefixTextProperty = DependencyProperty . RegisterAttached (
325
- "PrefixText" , typeof ( string ) , typeof ( TextFieldAssist ) , new PropertyMetadata ( default ( string ? ) ) ) ;
326
-
327
- public static void SetPrefixText ( DependencyObject element , string ? value )
328
- => element . SetValue ( PrefixTextProperty , value ) ;
329
-
330
- public static string ? GetPrefixText ( DependencyObject element )
331
- => ( string ? ) element . GetValue ( PrefixTextProperty ) ;
332
-
333
- #region Methods
334
-
370
+
335
371
/// <summary>
336
372
/// Applies the text box view margin.
337
373
/// </summary>
0 commit comments