1

I am trying to implement paste functionality in my application, which means a user can copy a number of files selecting from Windows Explorer and then paste it to the application using CTRL + C and CTRL + V.

The problem is CTRL + V only works on focused control. The code I used is:

<UserControl.InputBindings>
    <KeyBinding Modifiers="Control"
                Key="V"
                Command="{Binding PasteFilesCommand}" />
</UserControl.InputBindings>

My application is following the MVVM model. How can I capture a Ctrl+V event when focus is on any control of the application window?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
D J
  • 6,908
  • 13
  • 43
  • 75
  • [possible duplicate](http://stackoverflow.com/q/48935/620360). – LPL Jul 09 '12 at 07:33
  • 1
    @LPL - This question has not any clear answer for me. I cant find any answer where MVVM is followed and problem is resolved. – D J Jul 09 '12 at 08:18
  • @DJ Are you trying to paste into a specific control? – Bob. Jul 19 '12 at 20:19
  • Have a look at [MSDN Commanding Overview](http://msdn.microsoft.com/en-us/library/ms752308.aspx#simple_command), it has a simple example of binding to [ApplicationCommands.Paste](http://msdn.microsoft.com/en-us/library/system.windows.input.applicationcommands.aspx), which is used to provide _a standard set of application related commands_. – Bob. Jul 19 '12 at 20:22
  • @Bob I have read this article. But it does not solve my problem. In my application you can copy paste files from window explorer. Now if ctrl V pressed on my app. It should be captured. but problem is, if focus is on some child control then how you will fire Application.paste command which is on parent window. – D J Jul 20 '12 at 03:22

0 Answers0