Basically I want to create a keyboard shortcut which is valid within the scope of a window, and not just enabled when focus is within the control that binds it.
in more detail....
I have a window which has 3 controls:
- a toolbar
- a textbox
- a Custom Control
The toolbar has a button bound to the Command CustomCommands.CmdA
, and linked to keyboard shortcut Ctrl+T.
My Custom Control can process CmdA
. When I run the app and click on my custom control CmdA
is enabled and works fine. Also Ctrl+T causes the command to fire.
However when I select the text box, my custom command CmdA
becomes disabled.
I can rectify this by setting the command target for CmdA
's button. Now when I select the textBox, CmdA
is still enabled.
But the Keyboard shortcut Ctrl+T does nothing.
Is there any easy way to change the scope of keyboard shortcuts? Or do I need to catch the keypress somewhere lower down, and work out which Command it relates to and route it myself (if so is there a framework within which to do this?)