I planned to add support for the Back and Forward buttons found on many keyboards to my WPF application, but I'm trying my best to get them working.
I tried using the standard KeyBinding for BrowserBack and BrowserForward, without joy. I checked the code using the ESC key to make sure that it works in principle, and that key was ok.
Next, I handled the KeyUp event, but the key that is sent is "System", which is useless, and if I use KeyInterop.VirtualKeyFromKey, I just get 0.
I'm starting to think that PInvoke / trapping Real Window Messages will be the only option, but would I rather avoid this if anyone has any bright ideas?
Oh, and the keys themselves definitely work, and my keyboard is connected; -)
Update . They suggest using SystemKey so that I can understand how this works:
new KeyBinding(TestCommand, new KeyGesture(Key.Left, ModifierKeys.Alt));
And this seems to work for the keyboard button, but it does not work for the corresponding βflickβ touch (which mimics the next and back). These movies work great in browsers, but according to my KeyUp event, all they send is βLeftAltβ and not much more!
** Update again **: A great comment drew me to this:
this.CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseBack, BrowseBack_Executed));
this.CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseForward, BrowseForward_Executed));
Which seems to work, heals .. flicks too!