0

I'm creating an app that has start button which brings you to start page from anywhere in app.

However back navigation stack hurts when I just navigate to start page.

Looking for solution I found NonLinearNavigationService. The trouble is that download links are target to app hub, which (now, as we have new better app hub) redirects me to main page and nowhere further. Also I failed to find it on app hub using build in search engine.

Anyone knows where from can I get it?

Or maybe another solution for navigation loops?

Skiba
  • 440
  • 1
  • 6
  • 17

3 Answers3

1

No linear navigation in WP7 is generally not recommended, because of the hardware back button and the UX on the rest of the phone, so you should probably structure your app to avoid this. However it should pass the certification process.

Here's another similar question In-App Home Button to Navigate to MainPage allowed? and an article about circular navigation which mentions the NonLinearNavigationService you are talking about http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx.

Community
  • 1
  • 1
Ian Routledge
  • 4,012
  • 1
  • 23
  • 28
  • Thanks for quick answer. I found both of those, they made me look into NonLinearNavigationService. I'll give massive NavigationService.GoBack() a try – Skiba Aug 17 '12 at 11:58
  • Using a flag and GoBack() resulted in skipped pages blinking, so that's not a best looking solution... – Skiba Aug 17 '12 at 12:40
1

If the only non-linear part of the navigation is the home button, you could use NavigationService.RemoveBackEntry() in a loop untill it raises an InvalidOperationException in the home button event. When the InvalidOperationException is raised the BackStack is empty and the next click on the back button exits the application.

1

If you use RemoveBackEntry(), the entries are programmatically cleared from the backstack so you don't have to deal with the side effects of actually navigating back through the pages to pop them off the stack.

The NonLinear Navigation Service effectively does what you have tried. It calls GoBack() to traverse back up the stack. What it additionally does to prevent the flicker is to make the root frame transparent. See this question:

Skip a page when the back button is pressed, WP7

I don't want to call your question a duplicate because I think before Mango came out, that was probably the solution that needed to be used. Now that RemoveBackEntry() has been added to NavigationService, I think using that would probably be the better approach.

Community
  • 1
  • 1
Gambit
  • 2,455
  • 18
  • 20
  • Thanks, I'll try remove everything with RemoveBackEntry(). I found this answer and wanted to try NonLinearNavigationService mentioned there, but failed to find a working download link – Skiba Aug 18 '12 at 14:13
  • 1
    @Skiba I'm not sure when the links will be restored in the new Windows Phone Dev Center. If you can't find it and it's still not available in the Deve Center, email me and I'll send you a copy. – Gambit Aug 18 '12 at 19:04
  • I would love to, but I can't find mail in your profile... I would be very greatful if you could send it to mine – Skiba Aug 20 '12 at 07:27
  • 3
    I shared it at this link: http://dl.dropbox.com/u/303082/NavigationService/NonLinear-WP-SLApp-Navigation-Service.zip – Gambit Aug 24 '12 at 06:48