Browse Source

watwut

pull/2778/head
Nikita Tsukanov 7 years ago
parent
commit
1c111aef6c
  1. 2
      src/Avalonia.Controls/Primitives/IPopupHost.cs
  2. 1
      src/Avalonia.Controls/Primitives/OverlayLayer.cs
  3. 2
      src/Avalonia.Controls/Primitives/PopupRoot.cs
  4. 4
      src/Avalonia.Controls/ToolTip.cs

2
src/Avalonia.Controls/Primitives/IPopupHost.cs

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

1
src/Avalonia.Controls/Primitives/OverlayLayer.cs

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

2
src/Avalonia.Controls/Primitives/PopupRoot.cs

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

4
src/Avalonia.Controls/ToolTip.cs

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

Loading…
Cancel
Save