Browse Source

Merge pull request #11057 from timunie/fix/CalendarDatePicker_Watermark

Fix Watermark not shown on CalendarDatePicker when clearing the value in code
github-merge-queue[bot] 2 years ago
parent
commit
c16ef8fc2c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Avalonia.Controls/CalendarDatePicker/CalendarDatePicker.cs

+ 2 - 1
src/Avalonia.Controls/CalendarDatePicker/CalendarDatePicker.cs

@@ -875,10 +875,11 @@ namespace Avalonia.Controls
         {
             if (_textBox != null)
             {
+                SetCurrentValue(TextProperty, String.Empty);
+                
                 if (string.IsNullOrEmpty(Watermark) && !UseFloatingWatermark)
                 {
                     DateTimeFormatInfo dtfi = DateTimeHelper.GetCurrentDateFormat();
-                    SetCurrentValue(TextProperty, string.Empty);
                     _defaultText = string.Empty;
                     var watermarkFormat = "<{0}>";
                     string watermarkText;