返回特定的全景/透视项目?

发布于 2024-10-18 12:00:15 字数 49 浏览 6 评论 0原文

我想知道当用户按“后退按钮”时是否可以进入 WP7 sdk 上的特定枢轴或全景项目。

I would like to know if is it possible when a user press "back button" to go in a specific pivot or panorama item on WP7 sdk.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

瀟灑尐姊 2024-10-25 12:00:15

您可以通过重写 OnNavieratedFromOnNavieratedTo 事件并使用 PhonePageApplication.State 属性,确保用户始终返回到他们离开的项目存储所选项目。即使应用程序在不同页面上被逻辑删除,这也将起作用。

例如:

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
    State.Add("selectedPivot", myPivot.SelectedIndex);

    base.OnNavigatedFrom(e);
}



protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    myPivot.SelectedIndex = (int)State["selectedPivot"];

    base.OnNavigatedTo(e);
}

请注意上面的内容未经测试,需要额外的检查和错误处理等,但应该足以让您开始。

You can make sure that the user is always returned to the item they left by overriding the OnNavigatedFrom and OnNavigatedTo events and using the PhonePageApplication.State property to store the selected item. This will work even if the app is tombstoned while on a different page.

Something like:

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
    State.Add("selectedPivot", myPivot.SelectedIndex);

    base.OnNavigatedFrom(e);
}



protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    myPivot.SelectedIndex = (int)State["selectedPivot"];

    base.OnNavigatedTo(e);
}

Please note the above is untested, requires additonal checks and error handling, etc. but should be enough to get you started.

戴着白色围巾的女孩 2024-10-25 12:00:15

通过在页面中实现 OnBackKeyPress 覆盖可能来实现此方法,但是,这与 Windows Phone 7 应用程序中的后退按钮行为不一致。后退按钮应该仅用于在应用程序的页面堆栈中向后导航,然后让应用程序在应用程序堆栈中向后导航。实施任何其他行为都是违反直觉的,并且也很可能无法通过认证。

It would be possible to implement this approach by implementing the OnBackKeyPress override in your page, however, this would not be consistent with back button behavior in Windows Phone 7 applications. The back button is supposed to only be used for navigating backwards through the application's page stack, and then to leave the application to navigate backwards through the application stack. To implement any other behavior would be counter-intuitive and is also highly likely to fail certification.

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