Browse Source
Merge pull request #2928 from ahopper/fix-nested-popups
fix nested popups closing
pull/3052/head
Steven Kirk
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
1 deletions
-
src/Avalonia.Controls/Primitives/Popup.cs
|
|
|
@ -450,7 +450,14 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
private bool IsChildOrThis(IVisual child) |
|
|
|
{ |
|
|
|
return _popupHost != null && ((IVisual)_popupHost).FindCommonVisualAncestor(child) == _popupHost; |
|
|
|
IVisual root = child.GetVisualRoot(); |
|
|
|
while (root is IHostedVisualTreeRoot hostedRoot ) |
|
|
|
{ |
|
|
|
if (root == this._popupHost) |
|
|
|
return true; |
|
|
|
root = hostedRoot.Host?.GetVisualRoot(); |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool IsInsidePopup(IVisual visual) |
|
|
|
|