当然,都要统一到 CommandBinding 上了。
使用 KeyBinding 就可以了。如果想要在菜单后面显示快捷方式,就使用 InputGestureText
代码如下:
<Window.CommandBindings>
<CommandBinding Command="zp:ZippyCommands.NodeDown" CanExecute="ZippyCommands_CanExecute" Executed="ZippyCommands_Executed" />
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Command="zp:ZippyCommands.NodeDown" Key="Z" Modifiers="Shift"></KeyBinding>
</Window.InputBindings>
<MenuItem Header="下移" Name="cmNodeDown" Command="zp:ZippyCommands.NodeDown" InputGestureText = "Shift+Z" />