Hotkey commands for Silverlight in MVVM?

前端 未结 3 912
猫巷女王i
猫巷女王i 2021-02-04 15:30

I\'m trying to fire commands based on keystrokes in Silverlight. As I understand you cannot use AccessKey or AcceleratorKey in Silverlight. Also it looks like the might be helpf

3条回答
  •  别跟我提以往
    2021-02-04 16:17

    Do you mean like Ctrl+v or such I have seen the following example at the MSDN site.

    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
    }
    

提交回复
热议问题