WP7 - 没有导航服务的后退按钮
是否可以在不使用导航服务的情况下捕获后退按钮事件?
StackOverflow 上的上一篇文章介绍了后退按钮事件(OnBackKeyPress 和事件处理程序 PhoneApplicationPage_BackKeyPress) 似乎仅在使用导航服务时才会触发。
我的实现是:
//Prepare the page;
NextPage page = new NextPage();
//When we are ready to transition
page.someData = data;
page.parent = this;
this.Content = page;
我使用它是为了我可以存储页面以供以后使用(本质上是为了我可以缓存它,特别是因为我的一些页面从互联网下载信息,这样我就可以像上面那样传递数据但是,我仍然需要使用后退按钮返回主页,
有没有办法在使用上述方法时触发后退按钮?
Is it possible to some how capture the Back Button Event without using the Navigation Service?
A previous post here on StackOverflow describes the the Back Button Events (both the overload of OnBackKeyPress and the event handler PhoneApplicationPage_BackKeyPress) only seem to fire when the navigation service is used.
My implementation is:
//Prepare the page;
NextPage page = new NextPage();
//When we are ready to transition
page.someData = data;
page.parent = this;
this.Content = page;
I'm using this so that I can store the page for use later (essentially so that I can cache it, especially since some of my pages download information from the internet, and so that I can pass it data like above. However, I still need to use the back button to return to the home page.
Is there anyway to trigger the back button while using the above method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
存储整个页面来缓存数据是一个坏主意,尤其是在 .Net CF 这样的有限环境中。
在处理相对少量的数据(例如几个字符串、xml 文件 <<)时,将数据存储在isolatedStorageSettings.ApplicationSettings 中1KB。否则将数据存储在独立存储中的文件中,例如音乐、图片、巨大的 xml 等。
Storing a whole page to cache the data is a bad idea especially in a limited environment like .Net CF.
Store the data in IsolatedStorageSettings.ApplicationSettings when dealing with relatively small amount of data e.g. couple of strings, xml file < 1KB. Otherwise store the data in a file in Isolated Storage e.g music, pictures, huge xmls etc.