I'm using AppWindow
to create multiple windows for the app, and I want the user to be able to make the windows full screen, but ApplicationView.TryEnterFullScreenMode
doesn't work, it returns false all the time when used in an AppWindow
.
Sample code from Microsoft Docs:
private void ToggleFullScreenModeButton_Click(object sender, RoutedEventArgs e)
{
var view = ApplicationView.GetForCurrentView();
if (view.IsFullScreenMode)
{
view.ExitFullScreenMode();
}
else
{
view.TryEnterFullScreenMode(); // Returns false in an AppWindow
}
}
How do you make an AppWindow
enter full screen mode?
For
AppWindow
you should useAppWindowPresenter.RequestPresentation
and passAppWindowPresentationKind.FullScreen
as parameter.The solution I came up with (based on this answer) handles exiting full screen mode using:
XAML:
Code behind: