diff --git a/src/Wpf.Ui/Controls/TextBox/TextBox.cs b/src/Wpf.Ui/Controls/TextBox/TextBox.cs
index befd9169..25b2f8ff 100644
--- a/src/Wpf.Ui/Controls/TextBox/TextBox.cs
+++ b/src/Wpf.Ui/Controls/TextBox/TextBox.cs
@@ -45,7 +45,7 @@ public class TextBox : System.Windows.Controls.TextBox
nameof(PlaceholderEnabled),
typeof(bool),
typeof(TextBox),
- new PropertyMetadata(true)
+ new PropertyMetadata(true, OnPlaceholderEnabledChanged)
);
/// Identifies the dependency property.
@@ -53,7 +53,8 @@ public class TextBox : System.Windows.Controls.TextBox
nameof(CurrentPlaceholderEnabled),
typeof(bool),
typeof(TextBox),
- new PropertyMetadata(true));
+ new PropertyMetadata(true)
+ );
/// Identifies the dependency property.
public static readonly DependencyProperty ClearButtonEnabledProperty = DependencyProperty.Register(
@@ -197,7 +198,7 @@ protected void SetPlaceholderTextVisibility()
SetCurrentValue(CurrentPlaceholderEnabledProperty, true);
}
}
- else
+ else if (CurrentPlaceholderEnabled)
{
SetCurrentValue(CurrentPlaceholderEnabledProperty, false);
}
@@ -263,4 +264,19 @@ protected virtual void OnTemplateButtonClick(string? parameter)
OnClearButtonClick();
}
+
+ private static void OnPlaceholderEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is not TextBox control)
+ {
+ return;
+ }
+
+ control.OnPlaceholderEnabledChanged();
+ }
+
+ protected virtual void OnPlaceholderEnabledChanged()
+ {
+ SetPlaceholderTextVisibility();
+ }
}