我將解釋什麼,我試圖在下列情況下做到:導航到另一個頁面時方向改變
我有兩個頁面 - MainPage.xaml中(定向人像)和LandscapeLeft.xaml(方向LandscapeLeft)。
當用戶在Lanscape位置上旋轉手機時,我想從MainPage.xaml
導航到LandscapeLeft.xaml
。
我已經爲完成如下:
XAML:
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
後面的代碼:
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
switch (e.Orientation)
{
case PageOrientation.LandscapeLeft:
NavigationService.Navigate(new Uri("/LandscapeLeft.xaml", UriKind.RelativeOrAbsolute));
break;
}
base.OnOrientationChanged(e);
}
當我從PortraitUp旋轉手機即可LandscapeLeft位置會發生什麼:
首先,MainPage.xaml的內容旋轉橫向,然後加載LandscapeLeft.xaml。
我想要做的是消除MainPage.xaml內容旋轉的過程。它看起來不太好,影響性能。簡單地說,當我旋轉手機時,我希望將LandscapeLeft.xaml加載 ,而無需事先更改MainPage.xaml的內容方向。
請問,有什麼建議嗎?
謝謝,作品非常出色。這就是我一直在尋找的! – Maku 2011-02-25 12:27:33
沒問題,很高興我能幫到 – 2011-02-25 12:31:33
是silverlight控件的框架嗎? – gurehbgui 2011-11-23 12:33:13