I have the follwing code (which is not working):
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
{
e.Handled = true;
if ((e.Key == Key.P) && (Keyboard.Modifiers == ModifierKeys.Alt))
{
MessageBox.Show("Thanks!");
}
}
Why doesn't this work? The event is firing, but
(e.Key == Key.P) && (Keyboard.Modifiers == ModifierKeys.Alt))
never evaluates to true. My similar events using Ctrl instead of Alt in this way work. Also my events that include Ctrl and Alt work as well.