代码之家  ›  专栏  ›  技术社区  ›  XFox

如何在全屏模式下显示特定控件uwp

  •  0
  • XFox  · 技术社区  · 8 年前

    我为uwp平台写了一个youtube客户端,现在我陷入了全屏模式。我已经根据 mediaelement with 编写了自己的视频播放器。

    { (window.current.content as frame).content=此; } separate independent media controls

    this

    private async void fullscreen_Click(object sender, RoutedEventArgs e)
        {
            if (!fullScreen)
            {
                ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
                mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
                (Window.Current.Content as Frame).Content = this;
            }
            else
            {
                ApplicationView.GetForCurrentView().ExitFullScreenMode();
                (Window.Current.Content as Frame).Content = mainPageBackup;
            }
        }
    
    2 回复  |  直到 8 年前
        1
  •  1
  •   Shawn Kendrot    8 年前

    设置 IsFullWindow

    private void OnFullScreenButtonClick(object sender, EventArgs e)
    {
        videoSource.IsFullWindow = true;
    }
    
        2
  •  0
  •   XFox    8 年前

    实际上,有一个简单的解决方案。感谢Alamakanambra的评论(以下为问题)。当我进入全屏时,我只是隐藏我不需要的一切。 MainPage VideoPage 订阅了它。

    public event EventHandler SetFullscreen;
    
    private async void fullscreen_Click(object sender, RoutedEventArgs e)
    {
        SetFullscreen.Invoke(this, null);
        if (!fullScreen)
        {
            ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
            mainPageBackup = (Window.Current.Content as Frame).Content as MainPage;
            (Window.Current.Content as Frame).Content = this;
        }
        else
        {
            ApplicationView.GetForCurrentView().ExitFullScreenMode();
            (Window.Current.Content as Frame).Content = mainPageBackup;
        }
    }