2014-02-21 3 views
0

Windows phone 용 응용 프로그램을 개발 중입니다.방향 변경시 Windows Phone UI 변경

비디오 플레이어가 있습니다.

이제 휴대 전화 방향이 바뀌면 UI를 변경하고 싶습니다. 동영상 플레이어는 전체 화면을 사용해야합니다.

하지만 문제는 UI가 변경 될 때 비디오 플레이어가 일시 중지되거나 멈추거나 다시로드되는 것을 원하지 않는다는 것입니다.

그래서 콘텐츠 패널 내에서 2 개의 격자를 만들었습니다.

나는 하나의 격자를 완전히 숨기고 비디오 플레이어를 다른 격자로 옮길 것이라고 생각했습니다. 이 다른 격자는 화면에서 볼 수있는 유일한 것이므로 전체 화면이됩니다.

하지만 비디오 플레이어가 피벗 안에 있습니다. 여기

이 (가)

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 

     <Grid Name="VideoPlayerGrid" > 
      <Grid.RowDefinitions> 
       <RowDefinition Height="*" /> 
      </Grid.RowDefinitions> 

      //I want my video player here - this should make it full screen 
     </Grid> 

     <Grid Name="ContentGrid"> //I would hide this grid completely 

      <phone:Pivot Name="Pivot1"> 
       <phone:PivotItem Header="PivotItem1"> 
        <Grid> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto"/> 
          <RowDefinition Height="Auto"/> 
         </Grid.RowDefinitions> 

         // my video player is here 

        </Grid> 
       </phone:PivotItem> 

       <phone:PivotItem Header="PivotItem2"> 

       </phone:PivotItem> 
      </phone:Pivot> 

가 어떻게 방향 변화를 처리 할 수 ​​xaml-입니까?

답변

0

먼저, 그 다음 XAML

의 페이지에 OrientationChanged="PhoneApplicationPage_OrientationChanged"를 추가로 그것을 처리 코드 숨김

private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) 
{ 
    if (e.Orientation == PageOrientation.Landscape || 
     e.Orientation == PageOrientation.LandscapeLeft || 
     e.Orientation == PageOrientation.LandscapeRight) 
     { 
      // do something    
     } 
     else 
     { 
      // do something    
     } 
} 
+0

내가 그 안에 작성해야 할 무엇 크리스 샤오, 나는이 방법에 대해 알고 타이, 하나의 그리드에서 다른 그리드로 비디오 플레이어를 가져 오려면 어떻게해야합니까 ?? 내 xaml 확인 - 비디오 플레이어 위치 및 방향을 변경 한 후 원하는 위치를 기록했습니다. – kshitijgandhi

+0

어쩌면 이전 그리드에서 컨트롤을 제거하고 새 눈금에 추가 할 수 있습니다. –

+0

Chris Shao, 네,하고 싶습니다. 어떻게해야합니까? – kshitijgandhi

관련 문제