Browse Source

Ensure layout before trying to move selection.

pull/10461/head
Steven Kirk 4 years ago
parent
commit
d5a68b4b22
  1. 7
      src/Avalonia.Controls/MenuItem.cs

7
src/Avalonia.Controls/MenuItem.cs

@ -309,7 +309,12 @@ namespace Avalonia.Controls
protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute;
/// <inheritdoc/>
bool IMenuElement.MoveSelection(NavigationDirection direction, bool wrap) => MoveSelection(direction, wrap);
bool IMenuElement.MoveSelection(NavigationDirection direction, bool wrap)
{
if (Presenter?.Panel is null)
(VisualRoot as ILayoutRoot)?.LayoutManager.ExecuteLayoutPass();
return MoveSelection(direction, wrap);
}
/// <inheritdoc/>
IMenuItem? IMenuElement.SelectedItem

Loading…
Cancel
Save