2

I just want to Know, how can I navigate between different panorama items in wp7 through c# code.

Thank you.

  • Maybe duplicate of this : [navigate with Quey string][1] [1]: http://stackoverflow.com/questions/9284334/how-to-navigate-to-different-pivot-items-in-wp7 – MBen Apr 19 '12 at 17:00

4 Answers4

1

Try this

Panorama.SetValue(Panorama.SelectedItemProperty, selectedItem);

This might solve the issue.

TutuGeorge
  • 1,972
  • 2
  • 22
  • 42
1

Just set the default item to which item u want to load for the user's view..

panSOS.DefaultItem = panSOS.Items[1];
Apoorva
  • 1,047
  • 13
  • 33
0

I haven't tried this out, but it should work.

  1. Loop through Panorama.Items and remove every item except for the one you want to focus on. Use a for loop instead of foreach to do this since you can't modify the collection while iterating using the latter.

  2. Call Panorama.UpdateLayout to force the panorama to redraw itself and switch to item you want to display.

  3. Add the items you removed in step 1.

Praetorian
  • 106,671
  • 19
  • 240
  • 328
  • There's the solution here: http://stackoverflow.com/questions/4622214/how-to-programatically-set-selected-panorama-item-in-wp7 which uses DefaultItem, which basically seems like what you're describing. – William Melani Apr 19 '12 at 19:23
  • @willmel DefaultItem only applies when first viewing the panorama i.e it is the first panorama item that will be displayed when navigating to the page. Setting this property will not switch between panorama items. – Praetorian Apr 19 '12 at 19:30
  • @willmel defaultitem just changes the order of the panorama items. – TutuGeorge Apr 20 '12 at 05:46
-2

If you're panorama control is called PanoramaControl1 then you should be able to use:

PanoramaControl1.SelectedIndex = 0

Where 0 is the first panorama page.

Cameron
  • 430
  • 2
  • 11
  • 3
    Nope, can't do that, [`Panorama.SelectedIndex`](http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.panorama.selectedindex%28v=vs.92%29.aspx) is read-only – Praetorian Apr 19 '12 at 17:53