Browse Source

close menu if the toplevel menu item is clicked and its already opened.

makes behavior consistent with wpf.
pull/2469/head
Dan Walmsley 7 years ago
parent
commit
80cd6632bd
  1. 13
      src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs

13
src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs

@ -336,7 +336,18 @@ namespace Avalonia.Controls.Platform
if (e.MouseButton == MouseButton.Left && item?.HasSubMenu == true)
{
Open(item, false);
if (item.IsSubMenuOpen)
{
if (item.Parent is Menu)
{
CloseMenu(item);
}
}
else
{
Open(item, false);
}
e.Handled = true;
}
}

Loading…
Cancel
Save