xfox111
xfox111

Reputation: 108

How to show specific control in fullscreen mode UWP

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 separate independent media controls.

And when I go to fullscreen I get this

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

Upvotes: 0

Views: 836

Answers (2)

xfox111
xfox111

Reputation: 108

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

Upvotes: 0

Shawn Kendrot
Shawn Kendrot

Reputation: 12465

Set the IsFullWindow property to true;

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

Upvotes: 1

Related Questions