locked
How to restore navigation state when initializing the app from a pinned tile?

    Question

  • Using the base grid template as an example:

    When the user goes to the detail page for an item they are able to pin that item to their start screen. When clicking on the pin I am able to capture the argument and I can navigate the user to the correct detail page. However when I do this the initial start screen was never loaded and the navigation object does not realize it has a GoBack option so the back arrow never displays to the user.

    How are we supposed to save and restore this information not only for this case but in the case that your app is terminated by the runtime?

    Thursday, April 26, 2012 1:55 AM

Answers

  • Hi BC,

    It is up to you to save state in your application (even if you created it from a template) and you must decide what makes sense in navigation for your particular app.

    Pinned tiles are different from restoring state.  Pinned tiles are designed to focus you in on a certain aspect of your app.  For example, try the Finance app.  Navigate around thought the app.  Then add a watch for your favorite stock.  Pin that stock as a tile.  Navigate with the back button and you will go through your history.  Finally exit the app.  Doing this you have closed the application and starting the app again you would return to the home page.  Now you have a quick link to get to your favorite stock!  Click on that link.  You will see the back nav arrow returns you to the home page of that app.  That makes sense!

    Here is another example:  Navigate around your app and pick a different stock to look at.  Then without closing hit your created pinned tile.  In this case you were somplace in the app when you clicked on the tile.  So I would say that it make sense that the back button would take you from your favorite stock back to the one you were viewing previously.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465372.aspx

    I would strive for this type of experience in your application.  Use the activation state and previous excecution state to make the determination when to save the navigation history and when not to.

    -Jeff


    Jeff Sanders (MSFT)

    Friday, April 27, 2012 4:43 PM
    Moderator

All replies

  • This is the correct behavior.

    Your app will not have a GoBack state because you started at that page... there is no page to navigate back to!

    You could add a Home button to your app bar however. 

    You could also change the logic so that the back arrow moves you up in the hierarchy but then it is not really GoBack in navigation.  This would only be relevant however if your detail page can be entered from more than one page.


    Jeff Sanders (MSFT)

    Thursday, April 26, 2012 2:43 PM
    Moderator
  • I understand that I'm just a bit confused considering you are supposed to be able to code your app to be able to reactivate from suspension exactly the way it was before. If this is not feasible with the current provided template then why was it done the way it is?
    Thursday, April 26, 2012 7:33 PM
  • Hi BC,

    It is up to you to save state in your application (even if you created it from a template) and you must decide what makes sense in navigation for your particular app.

    Pinned tiles are different from restoring state.  Pinned tiles are designed to focus you in on a certain aspect of your app.  For example, try the Finance app.  Navigate around thought the app.  Then add a watch for your favorite stock.  Pin that stock as a tile.  Navigate with the back button and you will go through your history.  Finally exit the app.  Doing this you have closed the application and starting the app again you would return to the home page.  Now you have a quick link to get to your favorite stock!  Click on that link.  You will see the back nav arrow returns you to the home page of that app.  That makes sense!

    Here is another example:  Navigate around your app and pick a different stock to look at.  Then without closing hit your created pinned tile.  In this case you were somplace in the app when you clicked on the tile.  So I would say that it make sense that the back button would take you from your favorite stock back to the one you were viewing previously.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465372.aspx

    I would strive for this type of experience in your application.  Use the activation state and previous excecution state to make the determination when to save the navigation history and when not to.

    -Jeff


    Jeff Sanders (MSFT)

    Friday, April 27, 2012 4:43 PM
    Moderator