timheuer / callisto

A control toolkit for Windows 8 XAML applications. Contains some UI controls to make it easier to create Windows UI style apps for the Windows Store in accordance with Windows UI guidelines.
http://timheuer.com/blog/archive/2012/05/31/introducing-callisto-a-xaml-toolkit-for-metro-apps.aspx
Other
338 stars 108 forks source link

Menu doesn't check parent is Flyout #140

Closed stefanolson closed 11 years ago

stefanolson commented 11 years ago

In Menu.OnKeyDown, case Windows.System.VirtualKey.Escape doesn't check to see if the parent is a Flyout and thus crashes it is isn't. Would be better to use the function I provided the other day for menuitem, like this: var flyout = MenuItem.TryFindVisualTreeParent(this); if (flyout != null) { flyout.IsOpen = false; }