mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-28 23:08:36 +08:00
Fix ContextMenu submenu click bug
This commit is contained in:
@@ -69,6 +69,7 @@ public class ContextMenu : AvaloniaContextMenu,
|
||||
_popup.SetIgnoreIsOpenChanged(true);
|
||||
_popup.IsMotionAwareOpen = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private bool MenuPopupClosePredicate(IPopupHostProvider hostProvider, RawPointerEventArgs args)
|
||||
@@ -81,6 +82,11 @@ public class ContextMenu : AvaloniaContextMenu,
|
||||
popupRoots.UnionWith(MenuItem.CollectPopupRoots(childMenuItem));
|
||||
}
|
||||
}
|
||||
|
||||
if (_popup?.Host is PopupRoot popupRoot)
|
||||
{
|
||||
popupRoots.Add(popupRoot);
|
||||
}
|
||||
return !popupRoots.Contains(args.Root);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ public class MenuItem : AvaloniaMenuItem
|
||||
private bool MenuPopupClosePredicate(IPopupHostProvider hostProvider, RawPointerEventArgs args)
|
||||
{
|
||||
var popupRoots = CollectPopupRoots(this);
|
||||
|
||||
return !popupRoots.Contains(args.Root);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user