How to programmatically set selected Panorama item in WP7

后端 未结 6 692
春和景丽
春和景丽 2020-11-30 10:37

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\

6条回答
  •  一个人的身影
    2020-11-30 10:55

    Set new selected item by

    pan.SetValue(Panorama.SelectedItemProperty, pan.Items[newSelectedItem]);
    

    However, it work only on the initial so my idea is let the panorama control re-init when we change the selected item. This is my code, just add this after Panorama.SelectedItem changing.

    (pan.Items[curIndex] as PanoramaItem).Visibility = Visibility.Collapsed;
    pan.SetValue(Panorama.SelectedItemProperty, pan.Items[(curIndex + 1) % pan.Items.Count]);
    pan.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
    (pan.Items[curIndex] as PanoramaItem).Visibility = Visibility.Visible;
    

    But there is not transition effect now! Although, you can create your self.

    It work great for me, this page also create a effect for sliding right http://xme.im/slide-or-change-panorama-selected-item-programatically

提交回复
热议问题