Browse Source

Close DropDown on Escape.

pull/72/merge
Steven Kirk 11 years ago
parent
commit
e787bf3f4c
  1. 16
      Perspex.Controls/DropDown.cs

16
Perspex.Controls/DropDown.cs

@ -71,11 +71,19 @@ namespace Perspex.Controls
{
base.OnKeyDown(e);
if (!e.Handled &&
(e.Key == Key.F4 || (e.Key == Key.Down && ((e.Device.Modifiers & ModifierKeys.Alt) != 0))))
if (!e.Handled)
{
this.IsDropDownOpen = !this.IsDropDownOpen;
e.Handled = true;
if (e.Key == Key.F4 ||
(e.Key == Key.Down && ((e.Device.Modifiers & ModifierKeys.Alt) != 0)))
{
this.IsDropDownOpen = !this.IsDropDownOpen;
e.Handled = true;
}
else if (e.Key == Key.Escape)
{
this.IsDropDownOpen = false;
e.Handled = true;
}
}
}

Loading…
Cancel
Save