public static bool IsModifierKey(this Key key) { bool result = false; switch (key) { case Key.LeftShift: case Key.LeftAlt: case Key.LeftCtrl: case Key.RightAlt: case Key.RightCtrl: case Key.RightShift: result = true; break; } return result; }