Search code examples
windows-phone-7panorama-control

WP7 Sample Using Tiles to navigate and re-order panorama items that are DataBound without removing the Pivot-Items?


I am really confused here. I did read all the tips on how to navigate panorama items, searched all the forums and did come to a solution by removing all items, and re-adding them and setting the desired panorama item as selected item. This works really good. The problem is only, that i loose all data-bindings, when I remove the panorama-items from the panorama control. I was thinking about not to allow any navigation options, and to let the user only slide through the panorama-items, and not jumping to a specific item via tile. Currently I am stuck and don't know how to prevent data loss. Thank you.


Solution

  • It is generally not recommended to move the panorama items around. If you need to add more information, the app should navigate to a new page. If you want the panorama to start on a different page (like the Picture Hub) you can do this by setting the DefaultItem of the Panorama. A good way to do this is to store the index of the item you want, then retrieve it later to get the item and then set the DefaultItem property.

    // Store index
    IsolatedStorageSettings.ApplicationSettings["PanoramaIndex"] = MyPanorama.SelectedIndex;
    
    
    ...
    // Get index and set
    int index;
    IsolatedStorageSettings.ApplicationSettings.TryGetValue("PanoramaIndex", out index);
    object defaultItem = MyPanorama.Items[index];
    MyPanorama.DefaultItem = defaultItem;