开发者

WP7 and silverlight similar navigation flow

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


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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜