I've got a WPF (prism) app, which uses a whole lot of other WPF assemblies and even win32 dlls containing other windows (wpf and win32).
When the user presses a function Key (F2-F12) I want to open spezific program functions.
Something like this:
RoutedCommand commandF4 = new RoutedCommand();
commandF4.InputGestures.Add(new KeyGesture(Key.F4));
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(commandF4, CallCommandF4));
The problem is: this does only work while the MainWindow has the focus. If I open a secondary WPF window (or a win32 window) the keybinding does not apply anymore.
Is there any way to add an applicationwide global hotkey for F4 (or some other key)?
Or at least a WPF-wide hotkey?