WP7 - 没有导航服务的后退按钮

发布于 2025-01-07 12:06:53 字数 890 浏览 3 评论 0原文

是否可以在不使用导航服务的情况下捕获后退按钮事件?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缘字诀 2025-01-14 12:06:53

存储整个页面来缓存数据是一个坏主意,尤其是在 .Net CF 这样的有限环境中。

  • 它使应用程序变得复杂(复杂的导航逻辑,可能的循环)
  • 应用程序仅限于 90MB 内存

在处理相对少量的数据(例如几个字符串、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.

  • it complicates the app (complicated navigation logic, possible cycles)
  • app is limited to 90MB of memory

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文