UWP Windows 10 App, Windows startup size and full screen


"Hello World"!

In some scenarios you might want to launch your brand new Windows 10 app with a specific size and/or you might want to set a minimum size in order to properly code the adaptive UI layer.

To launch your view with a specific size you first need to change the default startup mode:

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

then specify the size:

ApplicationView.PreferredLaunchViewSize = new Size(800, 800);

Instead, to set the smallest size allowed for a view you can simply call the following method:

ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(200, 200));

This method accepts any size between the range 192x48 and 500x500.

If you want to apply these settings to your main view the best place where to set them is inApp.xaml.cs just before the Window.Current.Activate() method.

What about fullscreen mode?

If you want to start the app in full screen mode just set the following enum:

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

Othewise if you want to switch to full screen at runtime you need to use a different method:

ApplicationView.GetForCurrentView().TryEnterFullScreenMode();

It returns a boolean indicating if it succeeded or not, so you may programmatically change your code behavior based on the result.

Small note: the full screen mode is different from a maximized window because hides the title and the windows taskbar.

Comments (2)

  1. Dr. Venkman says:

    How about ensuring the Windows is properly centered on screen?

Skip to main content