Browse Source

Close tooltip on null Tip value

Max Katz 4 years ago
parent
commit
e0a8248fba
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/Avalonia.Controls/ToolTipService.cs

+ 10 - 3
src/Avalonia.Controls/ToolTipService.cs

@@ -38,9 +38,16 @@ namespace Avalonia.Controls
 
             if (ToolTip.GetIsOpen(control) && e.NewValue != e.OldValue && !(e.NewValue is ToolTip))
             {
-                var tip = control.GetValue(ToolTip.ToolTipProperty);
-
-                tip.Content = e.NewValue;
+                if (e.NewValue is null)
+                {
+                    Close(control);
+                }
+                else
+                {
+                    var tip = control.GetValue(ToolTip.ToolTipProperty);
+
+                    tip.Content = e.NewValue;
+                }
             }
         }