*Disclaimer - This is based on my experience with the current preview tools/SDK. Things may change in the future.*
So, you've got a Windows 8[.1] desktop app and want to port it to Windows 10 (or just want to build a Windows 10 app that will run on the desktop), read on.
If your app has more than one page you'll almost certainly have some way of navigating backwards through the page stack. The default way of doing this will be with some form of button on screen that the user can tap with their finger or click with their mouse.
But what about the keyboard?
Yes, it's possible to `Tab` to the back button and invoke it that way, but if you have a page with a lot of controls on it it may require a frustratingly large number of key presses to "tab" to the back button.
A common (defacto/unofficial) alternative is to use the keyboard `Escape` and/or `BackSpace` buttons as a shortcut.
If doing this you'll probably do so by adding a `KeyUp` (or `KeyDown`) event handler to the page.
Here's where it get's fun.
To have the page listen to keyboard events it needs to have focus (or contain controls that have focus and let event bubble up to it).
In Windows 8.1 a page code get focus and listen to events even if `IsTabStop` was false (the default).
In Windows 10 a page must have `IsTabStop` set to True to be able to get focus and be able to listen to key press events.
Discovering this cost me far more time than I would have liked. I document it here in the hope that it saves someone else some time in the future.
Useful post! Thanks
ReplyDelete