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

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

问题描述

我正在WP7应用中使用全景控件。 PanoramaItems之一会将您带到另一页,然后使您可以通过EmailComposeTask发送电子邮件。如果您未选择发送电子邮件,然后按返回按钮,则Panorama返回您上次选择的项目。但是,如果您确实选择发送电子邮件(并因此离开应用程序),则它不会返回到先前选择的PanoramaItem。而是返回到全景中的第一项。我尝试跟踪选定的索引并进行设置,但出现错误,表明SelectedIndex不可设置。这已在MSDN文档 http://msdn.microsoft.com/zh-cn/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中以编程方式设置选定的Panorama项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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