Navigation through your Windows Style app

I was navigating through the code I found inside the default project templates that are available for Windows Style apps. They already contain a lot of plumbing, specially around navigating through pages.

While reading the LayoutAwarePage.cs I found some code that handles keystrokes. I even found out something I did not know.

- Navigate backward in an app using Alt+Left
- Navigate forward in an app using Alt+Right

But strangely, I’m using to navigate backward using the Backspace key, this was not in the default LayoutAwarePage.cs code. But when you for example use the Store app navigating backward using the Backspace key will work. So let’s improve the default LayoutAwarePage to support the Backspace key as well. Just add the highlighted code to the CodeDispatcher_AcceleratorKeyActived method inside the LayoutAwarePage.cs.

/// <summary>
/// Invoked on every keystroke, including system keys such as Alt key combinations, when
/// this page is active and occupies the entire window.  Used to detect keyboard navigation
/// between pages even when the page itself doesn't have focus.
/// </summary>
/// <param name="sender">Instance that triggered the event.</param>
/// <param name="args">Event data describing the conditions that led to the event.</param>
private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender,
                                                    AcceleratorKeyEventArgs args)
    VirtualKey virtualKey = args.VirtualKey;

    // Only investigate further when Left, Right, or the dedicated Previous or Next keys
    // are pressed
    if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
            args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
        (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||
            (int) virtualKey == 166 || (int) virtualKey == 167))
        CoreWindow coreWindow = Window.Current.CoreWindow;
        var downState = CoreVirtualKeyStates.Down;
        bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
        bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
        bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
        bool noModifiers = !menuKey && !controlKey && !shiftKey;
        bool onlyAlt = menuKey && !controlKey && !shiftKey;

        if (((int) virtualKey == 166 && noModifiers) ||
            (virtualKey == VirtualKey.Left && onlyAlt))
            // When the previous key or Alt+Left are pressed navigate back
            args.Handled = true;
            this.GoBack(this, new RoutedEventArgs());
        else if (((int) virtualKey == 167 && noModifiers) ||
                    (virtualKey == VirtualKey.Right && onlyAlt))
            // When the next key or Alt+Right are pressed navigate forward
            args.Handled = true;
            this.GoForward(this, new RoutedEventArgs());
    if((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
            args.EventType == CoreAcceleratorKeyEventType.KeyDown) && args.VirtualKey==VirtualKey.Back)
        args.Handled = true;
        this.GoBack(this, new RoutedEventArgs());
  • Gravatar Michiel Post November 10th, 2012 at 14:45
    This code sample breaks the backspace when you're typing in a TextBox. A little bit of code should be added to check if no input, like a TextBox, currently has focus. You can do that with the FocusManager.GetFocusedElement();
  • Gravatar cheap nike blazers May 8th, 2014 at 10:06
    Browse Around This Web-site
  • Gravatar discounted nike sneakers May 8th, 2014 at 10:06
    Check out here
  • Gravatar pink nike running shoes May 8th, 2014 at 10:07
    Go To This Website
  • 誰かが書き込むと執筆の作品彼/彼女保持 計画彼/彼女の中でユーザーの心脳その方法それはユーザーが知っているのに注意して理解することができます。 だからその理由は、この段落 Navigation through your Windows Style app - Silverlight, WP7, .NET, C#, ASP.NET MVC ですバーゲン。ありがとう!
    ヘリテージ トートバッグ ポーター
  • Gravatar May 16th, 2014 at 03:49
    No one can reject from the quality of this video posted at this website, pleasant work, keep it all the time.
  • Gravatar May 16th, 2014 at 03:49
    I am actually eager of seeing funny video clips at youtube, and this video clip is actually so comic, hehehhe.
  • Gravatar May 16th, 2014 at 03:49
    Hi there friend, what a quality is! For this YouTube video, I am really happy, because I have never seen fastidious quality YouTube video earlier than,
  • Gravatar louis vuitton bags June 3rd, 2014 at 13:57
    It is appropriate time to make a few plans for the longer term and it is time to be
    happy. I've learn this submit and if I may I
    wish to recommend you some attention-grabbing things
    or advice. Maybe you can write next articles referring to this article.
    I desire to learn even more issues approximately
  • Gravatar Carole June 6th, 2014 at 12:15
    Its like you read my mind! You seem to know so much about this, like you wrote the book
    in it or something. I think that you could do with a few pics to
    drive the message home a little bit, but instead of that, this is excellent
    blog. A fantastic read. I'll certainly bbe back.
  • Gravatar Replica Hermes Bags Cheap June 25th, 2014 at 03:48
    Three Precious Instruction At a Stream Retirement
  • Gravatar Fake Hermes 2012 Handbags For Sale Cheap June 26th, 2014 at 04:09
    Excellent transaction, item &amp;amp; seller. Thanks for your 5 star service!
  • Gravatar vendita online hogan June 27th, 2014 at 05:29
    There you have it. Happy New Year.
  • Gravatar Wakizashi Sword June 28th, 2014 at 06:58
    A few Suggestions to Stop Reduced Confidence
  • Gravatar Japanese Katana swords for sale June 28th, 2014 at 07:37
    Points to consider When choosing Ergonomic Workplace Furnitures
  • Gravatar Ninja Katana Sword July 1st, 2014 at 15:05
    Three Most current Perfumes The Mustiness Purchase
  • Gravatar Katana Swords July 4th, 2014 at 06:20
    Perfect transaction- ideal
  • Gravatar chanel bags July 19th, 2014 at 06:25
    I enjoy you because of your entire efforts on this site. Kim delights in engaging in internet research and it's really simple to grasp why. We notice all regarding the powerful medium you deliver priceless techniques by means of your website and as well as encourage response from website visitors on the matter while our own child is without a doubt being taught a lot. Have fun with the rest of the new year. You're the one doing a terrific job.
  • Gravatar chanel handbags August 2nd, 2014 at 04:20
    I have to show some thanks to you for bailing me out of this type of predicament. Right after checking throughout the online world and coming across methods which were not productive, I figured my entire life was over. Being alive devoid of the answers to the difficulties you've solved by means of the short article is a crucial case, as well as those that might have adversely affected my career if I had not come across the website. The mastery and kindness in dealing with the whole lot was precious. I don't know what I would have done if I had not encountered such a stuff like this. I am able to at this point look ahead to my future. Thanks a lot very much for the skilled and effective guide. I will not hesitate to suggest the blog to any person who will need support on this issue.
  • Gravatar Sakabato for sale August 4th, 2014 at 19:15
    Thanks for a perfect transaction! Beautiful shoe! A+++++
  • Gravatar Discount Parajumpers UGO Men Jackets Sale September 7th, 2014 at 16:48
    Nice, received one later than expected
  • Gravatar Marietta September 9th, 2014 at 00:23
    Thanks a bunch for sharing this with all folks you really
    recognize what you're speaking approximately! Bookmarked.
    Please additionally discuss with my web site =). We may
    have a link change arrangement among us
  • Gravatar Patrickniz September 21st, 2014 at 11:03 カシオ オンラインショッピング 財布 クロエ 3p1i rii ハミルトン 時計 メンズ カシオ ランナーズウォッチ i7w nwh カシオ アナログ 腕時計 xgr kx5 ハミルトン 時計 メンズ クロエ ポシェット
  • Gravatar moncler pas cher丨moncler pas cher 2014 September 24th, 2014 at 12:26
  • Gravatar Patrickniz September 25th, 2014 at 06:44 カシオ腕時計 カシオ 腕時計 歴史 m6eq 8fd 嬉野 ハミルトン カシオ スマホ ke5 2iq クロエ ポシェット 1az iqd クロエ サイフ カシオショップ
  • Gravatar rayban サングラス 定価 September 25th, 2014 at 20:36
     Napa Vly vacation holiday resort have turn into consequently pleasant Nippon military couldn't also YOU. UTES. use her wrists and hands, and also several dismay.<br> Every pass the time as well as.
  • Gravatar Lamar September 26th, 2014 at 18:59
    Hey there just wanted to give you a quick heads up and let you know a few of the
    images aren't loading properly. I'm not sure why but I
    think its a linking issue. I've tried it in two different internet
    browsers and both show the same results.
  • Gravatar mbt瑞士健體鞋官網 November 10th, 2014 at 11:30 tunisha
  • ugg 店舗,
  • ugg クラシックミニ モカシン,
  • Gravatar Douglas December 4th, 2014 at 18:17
    Hi there, all the time i used to check blog posts here early in the dawn, as i like to find out more and more.
  • Gravatar gnorra service January 10th, 2015 at 21:40
    I have learned result-oriented things by your site. One other thing I would really like to say is always that newer pc operating systems have a tendency to allow extra memory for use, but they furthermore demand more memory simply to work. If someone’s computer is unable to handle extra memory and also the newest software requires that memory space increase, it can be the time to buy a new Personal computer. Thanks
  • Gravatar car games January 11th, 2015 at 21:22
    What’s Happening i’m new to this, I stumbled upon this I’ve found It positively helpful and it has helped me out loads. I hope to contribute & help other users like its helped me. Great job.
  • Gravatar Maillot Ligue 1 January 27th, 2015 at 10:51
    Maillot Ligue 1
  • Gravatar Julius February 3rd, 2015 at 13:09
    Really when someone doesn't know afterward
    its up to other viewers that they will assist, so here
    it happens.

    homepage, Julius,
  • Gravatar yellow usamz909 earphone accessory March 27th, 2015 at 18:51
    I'm now not positive where you are getting your information, however great topic.
    I needs to spend a while finding out much more or understanding more.
    Thanks for fantastic info I was looking for this info for my mission.
  •  having their tea, you happen to be grab the activity, it is especially basic collude at the same time, Could be he / she cannot be on this story with it all. Your an opportunity to!
  • Gravatar polo ralph lauren barato May 18th, 2015 at 02:22
    Hoy recibió un regalo de cumpleaños, así que muy feliz, es una chaqueta de llevar toda la razón, el precio parece no es caro, es recomendable que usted puede ir a ver las tiendas.
  • Gravatar Rafaela May 22nd, 2015 at 14:31
    Can you tell us more about this? I'd care to find out some
    additional information.
    webpage (Rafaela)
  • Gravatar Lacey June 3rd, 2015 at 21:21
    Very good blog post. I absolutely appreciate this site. Stick with it!

    site - Lacey -
  • Gravatar Glenna June 3rd, 2015 at 23:39
    Simply disregard the online namecalling nonsense on finishing up that rebuttal and just
  • Gravatar June 4th, 2015 at 02:42
    Hi mates, fastidious piece of writing and pleasant urging commented here, I am in fact enjoying by these.
  • Gravatar Marti June 6th, 2015 at 00:32
    Can you tell us more about this? I'd love to find out some additional information.
    webpage - Marti,
  • Gravatar July 6th, 2015 at 12:34
    Hi to every one, it's truly a good for me to pay a quick visit this website, it contains priceless
  • Gravatar Caroline July 7th, 2015 at 21:17
    I am regular visitor, how are you everybody? This paragraph posted at this website is
    actually nice.
    web site - Caroline -
  • Gravatar Riley September 1st, 2015 at 10:10
    After checking out a few of the blog articles on your web site,
    I seriously like your technique of writing a blog. I saved
    it to my bookmark website list and will be checking back in the near future.
    Please check out my web site as well and tell me how you feel.

  • Gravatar gel nails October 26th, 2015 at 09:06
    It's going to be end of mine day, but before ending I am reading this wonderful post to improve
    my know-how.
  • Gravatar ugg鞋 November 2nd, 2015 at 06:05
  • Gravatar Tachi December 4th, 2015 at 08:53
  • Gravatar Chanel February 12th, 2016 at 04:24
    On large places do not apply it in and set a little crumb together with the spot , initially you utilize it on that one position.
  • Gravatar February 12th, 2016 at 05:42
    Excellent bdat ! I would like to apprentice while you amend your site, how cann i subscribe for a bloog website?
    The account aided me a acceptable deal. I had been a little
    bit acquainted of this your broadcast provvided bright cpear concept
  • Gravatar Jerald February 12th, 2016 at 06:08
    Great article! We are linking too this particularly great article on our website.
    Keep up the great writing.
  • Gravatar May February 12th, 2016 at 06:44
    This article will assist the internet users for setting up neww blog or even a blog from start to end.
  • Gravatar Rashad February 12th, 2016 at 07:17
    I like looking through a post that will make people think.
    Also, thank you for allowing for me to comment!
  • Gravatar February 12th, 2016 at 10:00
    You're so cool! I do not think I've truly read thdough
    somethng like this before. So nice to find another person with slme original
    thoughts on this subject. Really.. thank you for starting ths up.

    This site is one thing that iis required on the internet, someone with a bit of originality!
  • Gravatar msp hack February 12th, 2016 at 10:56
    Children are far more protected on a dedicated video console system.
    The first scenario involves you as the celebrity character preparing to attend a movie premier where paparazzi and the press will be present.
    Total score is an indication of the overall player performance in game.
  • Gravatar February 12th, 2016 at 13:22
    wonderful issues altogether, you just won a new reader. What might you recommend about your puiblish that you made
    a few daygs in thhe past? Any certain?
  • Gravatar Gena April 30th, 2016 at 09:20
    Although it may not be much, these road blocks
    will offer you with an endless source of cost-free gems.
  • Gravatar シャネル時計 価格 ssd August 31st, 2016 at 06:20
    ルイヴィトン、シャネル、グッチ、エルメス、クロエ、プラダ、 ブルガリ、ロレックス、カルティエ 、オメガ偽物(コピー商品)のブランドのバッグ、財布、腕時計の販売、通販。
    グッチスーパーコピー,グッチ偽物バッグ,グッチ バッグ コピー,グッチ 新作
    シャネル時計 価格 ssd
  • Gravatar ブルガリ ブルー January 8th, 2017 at 08:47
    現在世界最高級のロレックスコピー、IWC、シャネル、パネライコピー などの各種類世界トップ時計が扱います。
    スーパーコピー時計の激安老舗.!アフターサービスも自ら製造したスーパーコピー時計なので、技術力でお客様に安心のサポー トをご提供させて頂きます。
    ブルガリ ブルー
  • Gravatar ブルガリ 銀座 営業時間 January 20th, 2017 at 10:52

    ブルガリ 銀座 営業時間
  • Gravatar iphone 5 カバー シャネル 激安 January 26th, 2017 at 08:45
    iphone 5 カバー シャネル 激安
  • Gravatar hay day cheats for ipad mini April 13th, 2017 at 11:38
    Insgesamt macht Hay Time natürlich sehr viel Spaß, denn die Aufgaben sind abwechslungsreich und
    es ist kein Abklatsch von FarmVille, sondern eine schöne
  • Gravatar Williambep November 10th, 2017 at 14:31
    <a href=>Fenty Puma Rihanna</a>
    Skincare had been only a matter of vanity. But it could also be a matter of health. Your skin layer can reveal your overall health. By way of example, in the event you don't make sure to protect your skin from your direct sun light, you will be going through pores and skin harm at the least and skin cancer in the most severe. This post can aid you to know how to take care of your epidermis.


    There are known risk factors for apnea. A number of obstructive sleep apnea risk factors are increasingly being overweight, a smoker, men, associated with an individual with obstructive sleep apnea or simply being Hispanic, Black, or perhaps a Pacific Islander. In case you have a number of of such risks, you are prone to simply being diagnosed with apnea.

  • Gravatar Floydbix November 20th, 2017 at 16:14
    <a href=>Louboutin Online Shop</a>
    To summarize, we certainly have offered you with a number of approaches you could take care of you horribly agonizing hemorrhoids. It is effecting your day-to-day lifestyle so you need some guidance. Ideally, you could actually discover something and will be able to use it to your great advantage.Things You Need To Know About Taking Much better Photographs


    When managing a candida albicans with lotions or suppositories, will not be determined by a diaphragm or even a condom for birth control. These drugs typically include skin oils that could destroy the latex of shield sorts of birth control. Utilize an alternate type of safety up until you are completed the path of remedy.

  • Gravatar 偽物ルイヴィトン November 23rd, 2017 at 13:47
    贈り物 ブレゼント通販!
  • Gravatar Michal October 2nd, 2018 at 18:02
    6. New York Academy for Appearing and Film.
  • Gravatar Claude October 9th, 2018 at 23:07
    Some schools make this a two-stage course of.