Reputation: 391
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
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
Reputation: 21
<KeyBinding Key="C" Modifiers="Ctrl" Command="Copy" CommandParameter="{Binding copy}" />
Upvotes: 0