Skip to content

Commit a51acea

Browse files
committed
MenuItem might have to look up the logical tree to find its menu parent (as in trayicon)
1 parent ed0ee65 commit a51acea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Avalonia.Controls/MenuItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ public bool StaysOpenOnClick
304304
bool IMenuItem.IsPointerOverSubMenu => _popup?.IsPointerOverPopup ?? false;
305305

306306
/// <inheritdoc/>
307-
IMenuElement? IMenuItem.Parent => Parent as IMenuElement;
307+
IMenuElement? IMenuItem.Parent => this.FindLogicalAncestorOfType<IMenuElement>();
308308

309309
protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute;
310310

0 commit comments

Comments
 (0)