I have the following code:
public void tbSpeed_KeyDown(object sender, KeyRoutedEventArgs e) { e.Handled = !((e.Key >= 48 && e.Key <= 57) ||
Bitwise AND the Modifiers property of Keyboard with Shift Key -
Bitwise AND
Modifiers
Shift
bool isShiftKeyPressed = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
Try this too-
bool isShiftKeyPressed = (ModifierKeys & Keys.Shift) == Keys.Shift;
OR
Control.ModifierKeys == Keys.Shift