简体   繁体   English

用于 CTRL+C 和 CTRL+V 手势的键绑定不起作用?

[英]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 + CCTRL + 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.

相关问题 如果MenuStrip设置了此快捷方式,则快捷键Ctrl + C Ctrl + V在文本框中不起作用 - Shortcuts Ctrl+C Ctrl+V dont work in Textboxes if MenuStrip has this Shortcuts set 在Excel中禁用复制(Ctrl + C),粘贴(Ctrl + V),剪切(Ctrl + X) - Disable copy(ctrl+c), paste(ctrl+v),cut(ctrl+x) in excel 在 Infragistics UltraGrid 中捕获 Ctrl+C、Ctr+V - Capturing Ctrl+C, Ctr+V in Infragistics UltraGrid 为什么TAB,DEL,Ctrl + C等在Windows Forms WebBrowser控件中不起作用? - Why do TAB, DEL, Ctrl+C, etc. not work in my Windows Forms WebBrowser control? 发送Ctrl + C进行处理 - Send Ctrl+C to process 如何将 ctrl+c 发送到 c# 中的进程? - How do I send ctrl+c to a process in c#? 制作十六进制蒙版后,不允许使用CTRL + C和CTRL + V - After making a hex mask CTRL+C and CTRL+V is not allowed 如何在DataGridView编辑模式下制作工作标准热键(Ctrl + C,Ctrl + Z)? - How to make work standard hotkeys (Ctrl+C, Ctrl+Z) in DataGridView Edit Mode? 允许在文本框中仅浮动(和负浮动),select 全部,复制并粘贴(Ctrl+A、Ctrl+C、Ctrl+V) - Allow in textbox only float (and negative float), select all, copy and paste (Ctrl+A, Ctrl+C, Ctrl+V) C#-覆盖Ctrl + C控件 - C# - Overwrite Ctrl+C control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM