2012-11-15 4 views
3

Windows 8 전화 프로젝트에서 작업 중이며 오른쪽 위 모서리에있는 변경 단추를 클릭하면 예상대로 작동하지 않습니다.Windows 8 전화 에뮬레이터 방향 변경 단추가 변경되지 않거나 "OnOrientationChanged"가 발생하지 않습니다.

전화 에뮬레이터가 가로 방향으로 변경되지만보기가 변경되지 않고 OnOrientationChanged 이벤트가 발생하지 않습니다.

또한 PortraitUp부터 PhoneApplicationPage.Orientation 속성도 변경되지 않습니다. 이것은 에뮬레이터의 버그입니까? 다른 누구에게도이 문제가 있습니까?

windows 8 휴대 전화는 자동으로 UI 요소를 재 배열해야합니까? 해당보기에 맞게 레이아웃이 지정되어 있지 않더라도?

답변

3

OrientationChanged 이벤트는 여전히 페이지의 SupportedOrientations 속성에 PortraitOrLandscape을 당신이 넣어 확인 윈도우 폰 8에서 작동하도록되어 : 당신은 단순히 Portrait 또는 Landscape두면

<phone:PhoneApplicationPage 
    x:Class="WP8Application.Page1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}"   
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480" 
    shell:SystemTray.IsVisible="True" 
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" 
    OrientationChanged="PhoneApplicationPage_OrientationChanged_1"> 

점이며, 지원되는 방향에서 이벤트는 으로 트리거되지 않습니다. 휴대 전화를 회전하더라도 응용 프로그램의 방향이 실제로을 변경하지 않기 때문입니다.

다른 질문에 대해서는 yes Windows Phone이 SupportedOrientations 속성을 올바르게 설정할 때 발견 한 것처럼 UI 요소를 자동으로 재 배열해야합니다. 대부분의 경우 요소의 위치를 ​​픽셀 단위로 명시 적으로 설정하지 않는 한 자동 레이아웃이 사용자의 요구에 맞아야합니다.

+0

감사합니다. 완벽하게 작동했습니다. –

0

Orientation은 Portrait가 아니어야합니다. 두 가지 Orientation 유형 모두에서 Page가 작동하려면 해당 매개 변수가 생략되고 SupportedOrientations 매개 변수 만 남겨 두어야합니다. Portrait에서 LandScape로 갈 때 에뮬레이터에서 작동하지 않는 것은 InputScope입니다. 아무도 언급하지 않는 것 같습니다.