如何在 WP7 中以编程方式设置选定的全景项目 [英] How to programmatically set selected Panorama item in WP7

查看:32
本文介绍了如何在 WP7 中以编程方式设置选定的全景项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 WP7 应用程序中使用全景控件.PanoramaItems 之一将您带到另一个页面,然后您可以通过 EmailComposeTask 发送电子邮件.如果您不选择发送电子邮件并按后退按钮,全景将返回到您上次选择的项目.但是,如果您选择发送电子邮件(因此离开应用程序),它不会返回到之前选择的 PanoramaItem.相反,它返回到全景中的第一项.我尝试跟踪所选索引并对其进行设置,但出现错误,指出 SelectedIndex 不可设置.这在 MSDN 文档 http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.panorama.selectedindex%28VS.92%29.aspx

I'm using a panorama control in a WP7 app. One of the PanoramaItems takes you to another page, which then allows you send an email through the EmailComposeTask. If you don't select to send the email and press the back button, the Panorama returns to the item you last selected. However, if you do select to send an email (and therefore leave the app), it does not return to the previously selected PanoramaItem. Instead, it returns to the first item in the Panorama. I tried keeping track of the selected index and setting it, but I got an error saying the SelectedIndex is not settable. This is confirmed on MSDN documentation http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.panorama.selectedindex%28VS.92%29.aspx

有没有办法在全景图上手动设置选定的索引/项目?如果没有,即使用户离开应用编写电子邮件,它是否也能记住选择的内容?

Is there any way to manually set the selected index/item on a panorama? If not, is there a way for it to remember what was selected, even if the user leaves the app to compose an email?

推荐答案

我不确定您是否可以通过编程将动画强制到另一个 PanoramaItem,但您可以更改 Panorama.DefaultItem.

I'm not sure if you can programmatically force an animation to another PanoramaItem, but you can change the Panorama.DefaultItem.

因此您可能有 3 个 PanoramaItem 并且在 OnNavigatedTo() 处理程序上,通过以下方式更改默认项目:

So you might have 3 PanoramaItem's and on the OnNavigatedTo() handler, change the default item via:

panoramaControl.DefaultItem = panoramaControl.Items[indexToSet];

当您从墓碑中恢复时,这应该会有所帮助.

This should help when you recover from a tombstone.

这篇关于如何在 WP7 中以编程方式设置选定的全景项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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