diff --git a/MahApps.Metro/Controls/Helper/TextBoxHelper.cs b/MahApps.Metro/Controls/Helper/TextBoxHelper.cs index 64b6071f5a..0cfc2bca21 100644 --- a/MahApps.Metro/Controls/Helper/TextBoxHelper.cs +++ b/MahApps.Metro/Controls/Helper/TextBoxHelper.cs @@ -24,6 +24,7 @@ public class TextBoxHelper public static readonly DependencyProperty UseFloatingWatermarkProperty = DependencyProperty.RegisterAttached("UseFloatingWatermark", typeof(bool), typeof(TextBoxHelper), new FrameworkPropertyMetadata(false, ButtonCommandOrClearTextChanged)); public static readonly DependencyProperty TextLengthProperty = DependencyProperty.RegisterAttached("TextLength", typeof(int), typeof(TextBoxHelper), new UIPropertyMetadata(0)); public static readonly DependencyProperty ClearTextButtonProperty = DependencyProperty.RegisterAttached("ClearTextButton", typeof(bool), typeof(TextBoxHelper), new FrameworkPropertyMetadata(false, ButtonCommandOrClearTextChanged)); + public static readonly DependencyProperty TextButtonProperty = DependencyProperty.RegisterAttached("TextButton", typeof(bool), typeof(TextBoxHelper), new FrameworkPropertyMetadata(false, ButtonCommandOrClearTextChanged)); public static readonly DependencyProperty ButtonsAlignmentProperty = DependencyProperty.RegisterAttached("ButtonsAlignment", typeof(ButtonsAlignment), typeof(TextBoxHelper), new FrameworkPropertyMetadata(ButtonsAlignment.Right, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure)); /// /// The clear text button behavior property. It sets a click event to the button if the value is true. @@ -329,17 +330,40 @@ private static void ControlGotFocus(TDependencyObject sender, } } + /// + /// Gets the clear text button visibility / feature. Can be used to enable text deletion. + /// [Category(AppName.MahApps)] public static bool GetClearTextButton(DependencyObject d) { return (bool)d.GetValue(ClearTextButtonProperty); } + /// + /// Sets the clear text button visibility / feature. Can be used to enable text deletion. + /// public static void SetClearTextButton(DependencyObject obj, bool value) { obj.SetValue(ClearTextButtonProperty, value); } + /// + /// Gets the text button visibility. + /// + [Category(AppName.MahApps)] + public static bool GetTextButton(DependencyObject d) + { + return (bool)d.GetValue(TextButtonProperty); + } + + /// + /// Sets the text button visibility. + /// + public static void SetTextButton(DependencyObject obj, bool value) + { + obj.SetValue(TextButtonProperty, value); + } + /// /// Gets the buttons placement variant. /// diff --git a/MahApps.Metro/Styles/Controls.PasswordBox.xaml b/MahApps.Metro/Styles/Controls.PasswordBox.xaml index 4679b6fb06..9d1f237fdc 100644 --- a/MahApps.Metro/Styles/Controls.PasswordBox.xaml +++ b/MahApps.Metro/Styles/Controls.PasswordBox.xaml @@ -326,6 +326,7 @@