How to show specific control in fullscreen mode UWP

拥有回忆 提交于 2019-12-11 17:34:55

问题


I write an YouTube client for UWP platform and now I'm stuck on fullscreen mode. I've written own video player based on MediaElement with .

And when I go to fullscreen I get this

.

So in that case I need to show in fullscreen mode the whole video player control. But I don't know how exactly I supposed to do this. I've already tried 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;
        }
    }

回答1:


Set the IsFullWindow property to true;

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



回答2:


Actually there's a one simple solution. Thanks to Alamakanambra's comment (below the question). I just hide everything that I don't need when I go to fullscreen. I've created an event and get MainPage and VideoPage subscribed to it.

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;
    }
}


来源:https://stackoverflow.com/questions/50865008/how-to-show-specific-control-in-fullscreen-mode-uwp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!