Multiple Navigation Service

Feb 14, 2013 at 9:03 PM
What have seen so far from Kona Guidance is very good, seems to handle everything an LOB needs but I have this use case, the application i'm building need to have different navigation stack for multiple sub-applications , here Microsoft calls it Hierarchical and Flat system

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh761500.aspx or navigation, the application needs both.

A Flat system where each Sub-App on the top bar would START a new Hierarchical navigation system, then if the user decides to , he could switch from one app to another by use the flat navigation system, which will re-position him at the right place. This looks a lot like the modern IE 10 in windows 8.

is it possible to handle this use case without any changes to the NavigationService?

Thanks and continue your good work.
Coordinator
Feb 15, 2013 at 6:36 PM
Thanks for your question. I'd imagine you would need a separate frame and associated NavigationService for each tab in the flat system. We didn't push on this scenario in our current guidance.
Feb 16, 2013 at 3:51 PM
I thought I'd drop in a few notes on this subject as abstracting the navigation stacks is something I'm working on currently with my Okra App Framework, and this scenario is one in particular I was looking to improve support for. If fact the requirement for multiple navigation structures is more generic than just this - for example all of file pickers/settings panes/share target/etc. each have their own independent navigation stacks and managing this in an MVVM manner can be quite difficult.

As fcheung commented this scenario will need a separate NavigationService. And there are a number of things to think about,
  • Different navigation stacks may have different properties. For example the main navigation stack shouldn't navigate back before the first page, whilst a settings pane lets you navigation back to the settings list. In Okra I have an INavigationBase (and abstract NavigationBase implementation) that abstracts this concept.
  • Persistence of state when suspending - for example in this case the root frame will need to store the current "sub-application" as well as each individual navigation stack.
  • Multiple lifetimes - not so much of an issue in this scenario, but hosted application views (file pickers etc.) may run outside of the main application's lifetime.
  • How does the view-model know which navigation service to send navigation requests to - in particular if a view/view-model is shared between multiple sub-applications. In Okra I am about to push some new code in that allows the view-model to import an INavigationContext that has a GetCurrent() method to return the currently relevant navigation service for this view-model.
I'll try to get a sample demonstrating how I would expect this to work with Okra after my next release.
Feb 20, 2013 at 7:37 PM
I'm really interested in seeing that code of your when it is finished.

I might have to look at your framework, seems promising.
Feb 21, 2013 at 11:49 AM
I will post here when I have something more concrete. I can update though to say that I have a proof-of-concept demo app with multiple navigation working, and will tidy this up and release it with the next release of Okra (the required APIs are in the current source code drop, but these need finalizing before I make a full release).

Thanks for you interest,
Andy