我使用這個模型,當設備進入橫屏模式切換到一個支點,我可能會最終提取當前項目的應用程序狀態。全景圖是橫向的禁止。
private int hub_page_index;
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
if (panorama.Visibility == Visibility.Visible)
{
hub_page_index = panorama.SelectedIndex;
}
else if (pivot.Visibility == Visibility.Visible)
{
hub_page_index = pivot.SelectedIndex;
}
if (e.Orientation == PageOrientation.Landscape
|| e.Orientation == PageOrientation.LandscapeLeft
|| e.Orientation == PageOrientation.LandscapeRight)
{
// Display Pivot in Landscape orientation
pivot.SetValue(Pivot.SelectedItemProperty, pivot.Items[panorama.SelectedIndex]);
panorama.Visibility = Visibility.Collapsed;
pivot.Visibility = Visibility.Visible;
}
else
{
// Display Panorama in Portrait orientation
panorama.SetValue(Panorama.SelectedItemProperty, panorama.Items[pivot.SelectedIndex]);
pivot.Visibility = Visibility.Collapsed;
panorama.Visibility = Visibility.Visible;
}
}
已更新,有關我最後一條有關DefaultItem的評論的澄清。 – 2011-01-08 02:07:05
我在這裏回答了這個:http://stackoverflow.com/questions/17980606/how-to-smoothly-navigate-to-a-different-panorama-item/27018310#27018310 – Rivenfall 2014-11-19 13:41:32