Thursday, June 18, 2015

Using a keyboard shortcut for the back button on your Windows [10] desktop app? Set IsTabStop on the page to True

*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.


  1. Useful post! Thanks

  2. Thanks for sharing this quality information with us. I really enjoyed reading.
    five nights at freddy's download | five nights at freddy's | fnaf

  3. Great post, thanks the author! if you need coursework or essay writing help - visit the website!

  4. Thank you author for sharing this amazing article with us.


  5. Your blog is very interesting, this is because your blog discusses about tips and unique informatics
    Lindungi Kesehatan
    Penting Kesehatan

  6. I want to thank mcdougal for this great efforts. I appreciate your time and effort in preparing this post. I appreciate your blog content articles.
    2015 Honda HRV Release Date Canada
    2016 Ford Escape Canada Review
    2016 Honda Civic Type R
    2016 Lexus RX 450h Release Date

  7. Very nice website and articles. I will be realy very pleased to visit your website. Now I am found that we actually want. I check your website everyday and attempt to learn something from a blog. Thank you and looking forward to your new submit.
    2016 Toyota 4Runner Diesel Space
    2016 Toyota Camry Hybrid Release Date
    2016 Toyota Corolla Release Date and Space
    2016 Toyota FJ Cruiser Price and Concept

  8. thank you!!! i need some app like this!