Nikita Tsukanov 6 years ago
parent
commit
1c111aef6c

+ 1 - 1
src/Avalonia.Controls/Primitives/IPopupHost.cs

@@ -6,7 +6,7 @@ namespace Avalonia.Controls.Primitives
 {
     public interface IPopupHost : IDisposable
     {
-        object Content { get; set; }
+        void SetContent(IControl control);
         IVisual VisualRoot { get; }
 
         void ConfigurePosition(IVisual target, PlacementMode placement, Point offset,

+ 1 - 0
src/Avalonia.Controls/Primitives/OverlayLayer.cs

@@ -117,6 +117,7 @@ namespace Avalonia.Controls.Primitives
         public void Add(Control v)
         {
             VisualChildren.Add(v);
+            InvalidateMeasure();
             InvalidateArrange();
         }
 

+ 2 - 0
src/Avalonia.Controls/Primitives/PopupRoot.cs

@@ -142,6 +142,8 @@ namespace Avalonia.Controls.Primitives
                 UpdatePosition();
         }
 
+        public void SetContent(IControl control) => Content = control;
+
         IVisual IPopupHost.VisualRoot => this;
         
         public IDisposable BindConstraints(AvaloniaObject popup, StyledProperty<double> widthProperty, StyledProperty<double> minWidthProperty,

+ 2 - 2
src/Avalonia.Controls/ToolTip.cs

@@ -236,7 +236,7 @@ namespace Avalonia.Controls
             Close();
 
             _popup = PopupHost.CreatePopupHost(control, null);
-            _popup.Content = this;
+            _popup.SetContent(this);
             ((ISetLogicalParent)_popup).SetParent(control);
             
             _popup.ConfigurePosition(control, GetPlacement(control), 
@@ -248,7 +248,7 @@ namespace Avalonia.Controls
         {
             if (_popup != null)
             {
-                _popup.Content = null;
+                _popup.SetContent(null);
                 _popup.Hide();
                 _popup = null;
             }