I have the following code (which does not work):
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) {
e.Handled = true;
if ((e.Key == Key.P) && (Keyboard.Modifiers == ModifierKeys.Alt)) {
MessageBox.Show("Thanks!");
}
}
Why is this not working? The event fires, but
(e.Key == Key.P) && (Keyboard.Modifiers == ModifierKeys.Alt))
never evaluates to true. My similar events using Ctrlinstead Altwork in this way. My events also work, which include Ctrl and Alt .
source
share