Ammark
Ammark

Reputation: 391

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. 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. Am I supposed to override them or something?.

<UserControl.InputBindings>
    <KeyBinding Gesture="CTRL+C" Command="{Binding CopyCommand}" />
</UserControl.InputBindings>

Upvotes: 3

Views: 4151

Answers (2)

A. Dzebo
A. Dzebo

Reputation: 646

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>

Upvotes: 1

user2629005
user2629005

Reputation: 21

<KeyBinding Key="C" Modifiers="Ctrl" Command="Copy" CommandParameter="{Binding copy}" />

Upvotes: 0

Related Questions