如何在不通过 PhoneApplicationPage 的情况下在 WINdows Phone 应用程序中访问 NavigationService? [英] How to I get access NavigationService in a WIndows Phone app without going through a PhoneApplicationPage?

查看:35
本文介绍了如何在不通过 PhoneApplicationPage 的情况下在 WINdows Phone 应用程序中访问 NavigationService?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不通过 PhoneApplicationPage 的情况下在 Windows Phone 应用程序中访问 NavigationService?我的目标是在启动时将它传递给应用程序的主要视图模型,这种技术在 WPF 和 Silverlight 中对我来说效果很好.

How to I get access NavigationService in a Windows Phone app without going through a PhoneApplicationPage? My goal is to pass it to the application's primary view-model on startup, a technique that worked quite well for me in WPF and Silverlight.

推荐答案

您可以从应用的 PhoneApplicationFrame 获取它.由于每个 Windows Phone 应用程序都有一个框架,因此可以从应用程序的任何位置访问它.

You can get it from the app's PhoneApplicationFrame. It will be accessible from anywhere in the app since every Windows Phone app has a Frame.

((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(...);

这篇关于如何在不通过 PhoneApplicationPage 的情况下在 WINdows Phone 应用程序中访问 NavigationService?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆