Maybe adding this to your page load event solve the problem
Application.Current.MainWindow.KeyDown += new KeyEventHandler(MainWindow_KeyDown);
Remove the handler if you are going to another page.
Вопрос
I have a page within a navigation window. I need to fire KeyDown events and they won't fire. I have this:
private void gamePlayerPage_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Right)
{
Animate newAnimate = new Animate(this.myMapController, this);
newAnimate.animation("right", this.myMinotaur);
}
}
And it is hooked up correctly. Any ideas how to make it fire? Thanks
Решение
Maybe adding this to your page load event solve the problem
Application.Current.MainWindow.KeyDown += new KeyEventHandler(MainWindow_KeyDown);
Remove the handler if you are going to another page.