How to Navigate to Panorama Item in Code

975 views Asked by At

I would like to programmatically navigate to a specific panorama item based upon a click event. I tried doing something like the following

if (Panorama != null && Panorama.SelectedIndex != 3)
        {
            Panorama.SelectedIndex = 3;  //Error, SelectedIndex is read only
        }

but the SelectedIndex property cannot be set. Is there a way to do this in code behind?

2

There are 2 answers

2
Pradeep Kesharwani On

Use this code it would work:

if (Panorama != null && Panorama.SelectedIndex != 3)
        {
            MyPanorama.DefaultItem = MyPanorama.Items[3];
        }
0
miguelarcilla On

Check this out. It's for Windows Phone 7, but I think the same still applies to 8. Maybe you should consider a different navigation model for your app? Or changing the DefaultItem and refreshing the page (I wouldn't recommend this though, it would just look confusing)?