Sil*_*ark 11 c# keyboard silverlight events keyboard-shortcuts
我有一个Silverlight应用程序,我可以在其中捕获某些按键,例如Tab或Ctrl执行某些操作.但是,我希望能够处理同时按下的多个键,例如Ctrl+ R或类似的东西.有没有办法在Silverlight中做到这一点,如果是这样,怎么样?
Dav*_*veB 15
查看ModifierKeys Enumeration以检查多个按键组合.有关代码示例和更多信息,请参阅Silverlight键盘支持.
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
}
Run Code Online (Sandbox Code Playgroud)