[英]KeyBinding for gestures CTRL+C and CTRL+ V do not work?
I have a few ICommands in my View Model which I would like to bind them using Key Board bindings to my user control.我的视图模型中有一些 ICommand,我想使用键盘绑定将它们绑定到我的用户控件。 The problem I am facing is that they are not fired when I use CTRL + C and CTRL + V to bind my copy and paste commands in my UserControl.我面临的问题是,当我使用CTRL + C和CTRL + V将我的复制和粘贴命令绑定到我的 UserControl 时,它们不会被触发。 Am I supposed to override them or something?.我应该覆盖它们还是什么?
<UserControl.InputBindings>
<KeyBinding Gesture="CTRL+C" Command="{Binding CopyCommand}" />
</UserControl.InputBindings>
This works for me like a charm:这对我来说就像一个魅力:
<!--COPY-->
<UserControl.InputBindings>
<KeyBinding Key="C" Modifiers="Ctrl" Command="{Binding CopyToStackCommand}" />
</UserControl.InputBindings>
<!--PASTE-->
<UserControl.InputBindings>
<KeyBinding Key="V" Modifiers="Ctrl" Command="{Binding PasteFromStackCommand}" />
</UserControl.InputBindings>
<KeyBinding Key="C" Modifiers="Ctrl" Command="Copy" CommandParameter="{Binding copy}" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.