WinRT Navigation and Conductors

Topics: Framework Services
Dec 5, 2012 at 7:16 AM
Edited Dec 5, 2012 at 4:18 PM

I have a WinRT app which is up and running nicely using the INavigationService (FrameAdapter). The problem is all of the pages in my app are full pages and they repeat a lot of view xaml markup. What I would like to do would be to have more of a "MasterPages" type of architecture where I have a shell view which defines the main layout and contains a ContentControl and uses the Conductor pattern to switch out the contents of the ContentControl. I have had success with this sort of architecture in the past with WPF and Silverlight so I assume it is possible in WinRT.

The problem is there seems to be a disconnect between the navigation infrastructure (using the FrameAdapter) and the Conductor infrastructure using a ContentControl bound to the ActiveItem of the conductor (like the SimpleNavigation sample).

In the conductor scenario I use ActivateItem() but with the INavigationService I use NavigateToViewModel<T>() and the two don't seem to be connected as far as I can tell.

One idea I had was to create a ConductorNavigationService which implements INavigationService and basically handles the creation and activation of the child screens. While it seems possible it doesn't seem very straight forward so I figured I would check here to see if there is an already supported way to do this.

I cross posted this question on StackOverflow:

Dec 11, 2012 at 12:41 AM

The answer on Stack Overflow covers a lot of it. 

One approach you might find useful is having your "MasterView" have a Frame control, when that control is Loaded you can then register it with WinRTContainer as an INavigationService (using FrameAdapter). This way you can still use navigation but wrapped around your master template.