navigationContext not being passed

Jul 13, 2013 at 1:25 AM
I wrote a simple two page demonstrator app, trying to follow the samples (although there is no Shell). I can navigate to the second page just fine but the back button never fires the command. I did some investigation and the ViewModel for the second page only ever has the default constructor called. Because the navigationContext never gets passed, the back command never works even though it is enabled.

Any thoughts on why this might be?
Coordinator
Jul 16, 2013 at 8:28 PM
Edited Jul 16, 2013 at 8:28 PM
Hi,

Sorry to hear that you are having some issues with the Okra App Framework. From your description it sounds like there is an issue with the construction and composition of your view-viewmodel pair. Without more insight into your code it's a bit hard to diagnose, but I have a few ideas for you.

The first question I have is how are you currently navigating to the second page? In Okra you should always navigate using the INavigationManager.NavigateTo(...) methods (you get an INavigationManager from the INavigationContext). I assume that the INavigationContext is available in the first page? As long as the Okra App Framework is responsible for creating the page, the view-model should be included automatically (unless something is going wrong).

The other thing to check is that the view-model is attributed with the [ViewModelAttribute("XXX")] where "XXX" is the same name used for the view.

One thing that might help you get started with the Okra App Framework is to try some of the project templates. You need to install the Okra App Framework Visual Studio Templates (see here] but then you should get a second set of new project templates specifically for Okra (see here for more information). These are a great way to get started learning the framework.

If you are still having problems and are able to share the code you are trying then I should be able to provide some more specific advice.

Regards,
Andy