You can use SetValue
on the Panorama
control:
private const string SELECTED_PANORAMA_INDEX_KEY = "selectedPanoramaIndex";
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// restore selected panorama item
if (State.ContainsKey(SELECTED_PANORAMA_INDEX_KEY))
{
int ndx = (int)State[SELECTED_PANORAMA_INDEX_KEY];
if(MainPanorama.SelectedIndex != ndx)
MainPanorama.SetValue(Panorama.SelectedItemProperty, MainPanorama.Items[ndx]);
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
State[SELECTED_PANORAMA_INDEX_KEY] = MainPanorama.SelectedIndex;
base.OnNavigatedFrom(e);
}