Home » VB.Net

Control Navigation History or get PhoneApplicationPages acts as singleton

I got a problem in managing application bar working well with the Navigation Service.

Starting with a top down navigation from list to detail I got no problem in managing navigation' back and forward.

The problem in on  introducing a application bar that it is common for every PhoneApplication page and implementing a navigation forward at any tap on applicationbarIconItem. At any tap it will add a new page instance on the navigation history stack every time while in my case will be better to reuse a previous instance if any or create a new one.

Is there a way to access and modify the history stack to reuse page instances or is it a way to create PhoneApplicationPages singletons?

P.S. I know that I can store the state of the pages and create new pages that are the same of the pages, but it seems a workaround to me.

Thank you




3 Answers Found


Answer 1

Hi Fabio,

An internal developer offered this approach to another internal developer (assuming your current approach is to create  an Application Bar in code):

If you want to have some consistent navigation  between multiple pages, you might want to instead modify  your content grid to have a row at the bottom (or top) where you have your navigation controls. Put a set of graphics in that row which navigate you to the various pages. You’d then have control  over what you want to animate when switching between pages.


Answer 2

HI Mark,

I was thinking to have a shared application  bar in all pages. Of course I can avoid this problem  having a main page  with the application bar  and pages  linked to the application bar without the application bar. That could be an acceptable solution.

I'm trying to figure out how I can alter the navigation  history or having a page that acts  as a singleton.

For example:

I have a common  application bar for every page in the app. The application bar links pages A,B,C,D.

If the user tap  on sequence  A, B, A, B, C due the navigation service  method navigate, there will be created 5 instances  of pages: 2 for A, 2 for B and 1 for C and those will be stacked on navigation history.

That forse the user to navigate back  5 pages to exit the application.

How is it possible to avoid that?

Is it possible to change the state  of the history? As I saw in Silverlight with method RemoveBackEntry ?

How can be possible to have one instance  Page that acts as singleton? That seems not possible to me because is not possible to navigate to an Object but just to an url.



Thank you for your support



Answer 3

Hi Fabio,

I am not aware that you can programmatically change the navigation  history but there is a workaround  to clear it here.  There are a number of samples and solutions regarding the whole issue of page  navigation. 

Simplify Page Transitions in Windows Phone 7 Silverlight Applications

Windows Phone: Frame/Page navigation and transitions using the TransitioningContentControl

Note that you'll also want to check OnNavigatedTo because this can happen if your SL app comes into the foreground after receiving a phone call for example.



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure