I have an application in which I have a UserControl
with a toolbar. This toolbar has an Execute
button, which in turn has its own command bound to the ICommand
derived class, which provides the viewmodel as a property.
<Button Grid.Row="0" Command="{Binding ExecuteCommand}">Execute</Button>
Now I would like to snap this to a keyboard shortcut ( F5
). This needs to be linked in the context of the UserControl
, because it only applies if this user control is currently displayed.
Another option is to bind it to a KeyDown
text field that actually contains the text to execute, but I'm very shaky when it comes to redirecting an event from a control to a command in view mode without really ugly hacks in the code for user control.
Any pointers are appreciated!
source share