2

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>
Mwiza
  • 7,780
  • 3
  • 46
  • 42
Ammark
  • 381
  • 1
  • 6
  • 17

2 Answers2

1

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>

A. Dzebo
  • 558
  • 6
  • 13
0
<KeyBinding Key="C" Modifiers="Ctrl" Command="Copy" CommandParameter="{Binding copy}" />
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
user2629005
  • 21
  • 1
  • 2