Browse Source

Select MenuItem on focus.

pull/58/head
Steven Kirk 11 years ago
parent
commit
5804ab7118
  1. 11
      Perspex.Controls/MenuItem.cs

11
Perspex.Controls/MenuItem.cs

@ -81,6 +81,7 @@ namespace Perspex.Controls
/// </summary>
static MenuItem()
{
FocusableProperty.OverrideDefaultValue<MenuItem>(true);
ClickEvent.AddClassHandler<MenuItem>(x => x.OnClick);
SubmenuOpenedEvent.AddClassHandler<MenuItem>(x => x.OnSubmenuOpened);
IsSubMenuOpenProperty.Changed.Subscribe(SubMenuOpenChanged);
@ -199,6 +200,16 @@ namespace Perspex.Controls
}
}
/// <summary>
/// Called when the <see cref="MenuItem"/> recieves focus.
/// </summary>
/// <param name="e">The event args.</param>
protected override void OnGotFocus(GotFocusEventArgs e)
{
base.OnGotFocus(e);
this.IsSelected = true;
}
/// <summary>
/// Called when a key is pressed in the <see cref="MenuItem"/>.
/// </summary>

Loading…
Cancel
Save