Browse Source

Actually invalidate menuitems when it got attached to the visual tree

pull/11791/head
Tim 3 years ago
parent
commit
34ba4c9c82
  1. 7
      src/Avalonia.Controls/MenuItem.cs

7
src/Avalonia.Controls/MenuItem.cs

@ -394,6 +394,13 @@ namespace Avalonia.Controls
_isEmbeddedInMenu = parent?.FindLogicalAncestorOfType<IMenu>(true) != null;
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
TryUpdateCanExecute();
}
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
// This will cause the hotkey manager to dispose the observer and the reference to this control

Loading…
Cancel
Save