Windows 10 universal app - Run in fullscreen mode by default
Asked Answered
V

3

13

I have application with target windows 8.1 and when I run this application on Windows 10, it is run in small window by default.

Because it is primary tablet application I need it to run in full-screen mode by default. Is it possible to set it somewhere in Visual Studio or in some config of the application?

Verniavernice answered 1/8, 2015 at 5:56 Comment(1)
The porting guide is here. I assume you are looking for the section way at the bottom, as good as it gets.Watercolor
D
39

To launch application in full screen mode, try setting ApplicationView.PreferredLaunchWindowingMode as early as in App.xaml.cs's constructor

public App()
{
    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

To have a button that toggles the full screen mode, do

var view = ApplicationView.GetForCurrentView();
if (view.IsFullScreenMode)
{
    view.ExitFullScreenMode();
}
else
{
    view.TryEnterFullScreenMode();
}

However, I need to add that even without specifying any of the code above, when you open your app inside a Windows 10 tablet or a Windows 10 desktop with Tablet Mode enabled, the app will automatically maximise itself to full screen.

As long as your app is available on Windows 10 Desktop devices, I would recommend you not to set it to full screen at start-up 'cause UX wise it's a lot easier for desktop users to work with windowed applications.

Douma answered 2/8, 2015 at 4:31 Comment(3)
Thanks for advice. But did you mean store application. Because your code is not available in windows store universal app. prntscr.com/8hv4mhVerniavernice
Now I see, this code is available only in Windows 10 universal app. I'm trying this in windows 8.1 appVerniavernice
Make sure to add 'using Windows.UI.ViewManagement;' to the top off your App.xaml.csShattuck
I
4

And in C++ :

Windows::UI::ViewManagement::ApplicationView::PreferredLaunchWindowingMode = 
Windows::UI::ViewManagement::ApplicationViewWindowingMode::FullScreen;
Ilowell answered 24/10, 2015 at 16:27 Comment(0)
F
1

try this:

this.InitializeComponent();
ApplicationView.GetForCurrentView().TryResizeView(new Size(1360, 768));
Friedland answered 3/6, 2020 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.