This project is read-only.

Multiple entry point - Multiple Navigation

Dec 10, 2012 at 2:03 AM

Hi Andy,

I'm trying to use Okra App Framework for my new LOB and I stumble upon something i'm wrestling with, here it is...

My application can be called using Protocol activation, with a parameter indicating what screen to show first, how can that be accomplish with Okra? Since it seems that it does need a default page - SpecialPageNames.Home, i'm thinking i could use the OnActivated and than use bootstapper.Navigationmanager.NavigateTo("whateverPage)


That seems to work, but now the more complicated thing, i need to have different navigation stack for multiple (let's call it) sub-applications , here Microsoft calls it Hierarchical and Flat system or navigation, i need 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.


Let me know if it is possible, or if you have an idea.


Dec 12, 2012 at 10:33 AM


I think I understand what you are trying to do and this should be possible with Okra.

Regarding activation you should be able to override the OnActivated method as you describe. You have two options here. Firstly you can override the Application.OnActivated(...) method and then use a bootstrapper that you created in the constructor. Alternatively the OkraBootstrapper class also has an OnActivated(...) method that consolidates many of the activation events and gives you a bit more flexibility whether you allow Okra to continue processing the activaton (if you want Okra to process the event you just call base.OnActivated(...) to continue the chain). There is actually a third option as Okra provides an IActivationHandler interface that you can export with MEF, however this is probably more complex than required.

Regarding having multiple sub-applications, you will need a separate navigation manager for each section. The good news is that the most recent release of Okra has refactored most of the navigation logic into a NavigationBase class. You will need to create a class that derives from this and create an instance for each sub-application. Things you will then need to add are,

  • Override the "CanGoBack" property - by default NavigationBase allows you to navigate to before the first page in the stack, you will need to replace this logic with 'return NavigationStack.Count > 1;'
  • Override the 'DisplayPage' method - this method is called every time the page is changed (i.e. navigation to a new page, or navigation back) and you should use this to set the window content to the page content (obviously in your case this should only occur if this is the active sub-application, and you will need to cache the page for when you navigate between sub-applications)
  • Provide something like 'RestoreNavigationStack' and the associated state persistence. This is all provided by the standard 'NavigationManager' but uses a hardcoded filename so each sub-application would overwrite each other's state.

The best approach is probably to take the NavigationManager implemetation from the Okra source code ( and modify it as this will contain 95% of the functionality that you require.

Hope this helps,


Dec 14, 2012 at 5:22 AM

This seems interesting, I will try to implement it and let you know , maybe we can merge my changes into the framework??? let's see how it goes first.

thanks for the answer

Dec 15, 2012 at 12:41 PM

That sounds good - let me know how you get on or if you have any further questions. Introduction of a more flexible navigation manager into the framework would be useful in this scenario as well as when in a hosted frame (e.g. a file open picker will need its own independent navigation stack).