Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在全屏模式UWP中显示特定控制_C#_Xaml_Uwp_Uwp Xaml - Fatal编程技术网

C# 如何在全屏模式UWP中显示特定控制

C# 如何在全屏模式UWP中显示特定控制,c#,xaml,uwp,uwp-xaml,C#,Xaml,Uwp,Uwp Xaml,我为UWP平台编写了一个YouTube客户端,现在我被困在全屏模式。我已经基于MediaElementwith编写了自己的视频播放器 当我进入全屏时,我得到了这个 所以在这种情况下,我需要在全屏模式下显示整个视频播放器控件。但我不知道该怎么做。我已经试过了: private async void fullscreen_Click(object sender, RoutedEventArgs e) { if (!fullScreen) {

我为UWP平台编写了一个YouTube客户端,现在我被困在全屏模式。我已经基于
MediaElement
with编写了自己的视频播放器

当我进入全屏时,我得到了这个

所以在这种情况下,我需要在全屏模式下显示整个视频播放器控件。但我不知道该怎么做。我已经试过了:

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;
        }
    }
将属性设置为true

private void OnFullScreenButtonClick(object sender, EventArgs e)
{
    videoSource.IsFullWindow = true;
}

实际上有一个简单的解决方案。感谢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;
    }
}

不。它不工作,因为我不仅需要在全屏模式下查看视频,还需要在全屏模式下查看控件。我认为
ApplicationView.GetForCurrentView().TryEnterFullScreenMode()应该足够了。另外-您没有更新
全屏
变量。@Alamakanambra是的,一开始我真的忘了更新
全屏
变量。但在这种情况下,这并不重要
ApplicationView.GetForCurrentView().TryEnterFullScreenMode()
不够,因为它将整个应用程序设置为全屏模式,但我还需要在全屏模式下打开视频播放器控件,所以只需隐藏任何其他元素……下面的答案可能会使
MediaPlayerElement
全屏显示。和播放按钮,下一个按钮将显示在底部,我不知道你想全屏显示哪个控件?@Alamakanambra实际上你是对的。这真是一个解决方案