0
votes

I am developing the application which consists of two pages. The first page is a menu where you can navigat to the second page which is some sort of a map. This application supposes to be run on Windows Phone 7 and Silverligth 4. Everything is built up on the MVVM pattern. For S4 I am using Unity, for WP7 I am creating very simply IoC container.

Getting to the bottom of the matter, I need to provide this application with a common navigation system. I know that S4 supports the new interface INavigationContentLoader which allows us to use our own content loader. Unfortunately, this does not work for WP7. I am also thinking about taking advantage of the Shell/Frame approach. Basically we have a shell or a frame control with a replaceable content. The navigation in this case is about replacing content. But I am afraid that this solution won't work properly for WP7, since the BACK button will close the app instead of stepping back to the previous page. Guys, do you have other ideas? What solution do you have? I want to stress that this solution should be consistent with MVVM. Best regards Jarek

1
Ok, so I will try to ask the question in the other way round. How can I have the navigation in WP7 which follows the MVVM pattern. So, I don't need to navigate directly from the view, but rather from the viewmodel. any hints? thanks - Jarek

1 Answers

0
votes

For such a small simple app I'd create my own wrapper around selecting the navigation mode dependent upon the platform.
Something like:

void MyNavigate(uri page)
{
#IFDEF WINDOWS_PHONE
    NavigationService.Navigate(page);
#ELSEIF
    NavigateTo(page); // or whatever is appropriate to your Silverlight 4 app
#ENDIF
}