C# - Detecting if the SHIFT key is held when opening a context menu

后端 未结 5 2063
感情败类
感情败类 2021-01-01 08:24

In my C# application I want to display a context menu, but I want to add special options to the menu if the SHIFT key is being held down when the context menu is opened.

5条回答
  •  梦毁少年i
    2021-01-01 08:56

    In silverlight, at least in latest versions, you must use:

    if(Keyboard.Modifiers == ModifierKeys.Shift) {
        ...
    }
    

提交回复
热议问题