2016-07-14 5 views
0

난 당신이 모든 비디오 플레이어에서 전체 화면 모드를 전환처럼 "MyControl"전체 화면을 만들기 위해 "btnFullscreen"을 클릭합니다 UserControl을 (MyControl 이름)UWP에서 UserControl 전체 화면을 만드는 방법은 무엇입니까?

<Grid Background="White"> 
     <MediaElement Name="Player"></MediaElement> 
     <Button Name="btnFullscreen" 
       VerticalAlignment="Bottom" 
       HorizontalAlignment="Center" 
       Content="Fullscreen"></Button> 
</Grid> 

및 MainPage.xaml을

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
     <Grid.RowDefinitions> 
      <RowDefinition/> 
      <RowDefinition/> 
     </Grid.RowDefinitions> 
     <local:MyControl></local:MyControl> 
</Grid> 

이 , 전체 화면 모드에서 "btnFullscreen"및 "Player"가 표시됩니다.

죄송합니다. 영어가 능숙하지 않아서 고맙습니다.

private void btnFullscreen_Click(object sender, RoutedEventArgs e) 
{ 
    ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); 
    Player.IsFullWindow = true; 
} 

그리고 MyControl.xaml :

답변

0

당신은 다음과 같은 코드로 전체 화면 모드로 MediaElement에 제어를 설정할 수 있습니다

<Grid> 
    <MediaElement Name="Player" AreTransportControlsEnabled="True" > 
    </MediaElement> 
    <Button Name="btnFullscreen" 
      VerticalAlignment="Bottom" 
      HorizontalAlignment="Center" 
      Content="Fullscreen" Click="btnFullscreen_Click"></Button> 
</Grid> 

업데이트 : 새로운 새로운 비디오 플레이어를 reate하려면 플레이 버튼, 볼륨 슬라이더, 전체 화면 버튼, 슬라이더 등과 같은 플레이어 컨트롤. 이 문서의 단계를 따르는 것이 좋습니다 : Create custom media transport control. 동영상 플레이어에 전체 화면 버튼을 추가하는 방법을 찾을 수 있습니다. 이 문서의 맞춤 버튼 추가 섹션을 참조하십시오. 다음은 맞춤 용지 전송 컨트롤의 공식 샘플입니다 : XamlCustomMediaTransportControls.

+0

"Player.IsFullWindow = true"를 사용하면 "플레이어"가 화면에 "btnFullscreen"을 표시하지 않습니다. 플레이 버튼, 볼륨 슬라이더, 전체 화면 버튼, 슬라이더와 같은 새로운 플레이어 컨트롤로 새로운 비디오 플레이어를 만들고 싶습니다 ... 고마워요! – Nam

+0

자신 만의 비디오 플레이어를 만들려면 사용자 지정 미디어 전송 컨트롤을 만들고이 컨트롤의 사용자 지정 단추로 전체 화면 단추를 추가하는 것이 좋습니다. 제 답변의 업데이트를 확인하십시오. –

+0

당신의 제안에 감사드립니다, 나는 그것을 시도합니다 :) – Nam

관련 문제