I have a Silverlight application in which I catch certain key presses such as TAB or CTRL to perform some action. However, I want to be able to handle multiple keys pressed at the same time such as CTRL + R or something like that. Is there any way to do that in Silverlight, and if so, how? Thank you in advance.
+2
A:
Take a look at the ModifierKeys Enumeration to check for multiple key press combinations. See Silverlight Keyboard Support for code samples and more information.
void Canvas_KeyUp(object sender, KeyEventArgs e)
{
//check for the specific 'v' key, then check modifiers
if (e.Key==Key.V) {
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) {
//specific Ctrl+V action here
}
} // else ignore the keystroke
}
DaveB
2010-04-12 05:06:38