What's the best way to handle the same shortcut in WPF and WinForms controls?

Posted by Anthony Brien on Stack Overflow See other posts from Stack Overflow or by Anthony Brien
Published on 2010-06-14T21:48:59Z Indexed on 2010/06/14 21:52 UTC
Read the original article Hit count: 486

I have a WPF application with the following KeyBinding on its main window:

<KeyBinding Command="Commands:EditCommands.Undo" Gesture="CTRL+Z" />
<KeyBinding Command="Commands:EditCommands.Redo" Gesture="CTRL+Y" />

This makes the command respond to the shortcut fine. However, in all the places where I have embedded WinForms text boxes or rich text boxes, I've lost the ability to use those shortcuts. If I remove the above bindings, the WinForms shortcuts work fine.

How can I support these shortcuts in both WinForms and WPF? I'd prefer a generic method since this problem is likely to affect many other commands with the same keybindings.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about winforms