I have a wpf window called MainMenuWindow
. I want to show a MessageBox
when the user presses F1 on their keyboard, no matter where they are on the window
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F1)
{
MessageBox.Show("Help");
}
}
This is what I have so far.
But I don't know where to reference it or if it's even right. I know how to do it on winforms applications, but cant seem to get it working on wpf.