I've just started learning UWP app development on Windows 10 Pro using Visual Studio 2015 Community Edition. I tried to modify the C# version of the official "Hello, World!" sample by setting the Width
and Height
attributes of the Page tag in MainPage.xaml.
Interestingly, when I start the app, its size will be different. Moreover, if I resize its window and then restart it, the app seems to remember its previous window size.
Is it possible to force a UWP app to have a predefined window size, at least on desktop PCs?
So here's the big reveal: you can easily full screen almost any UWP apps in Windows 10 just by hitting `Shift + Win + Enter` after focusing a UWP app. The shortcut should work with most UWP apps in Windows 10, but it may not work if an app doesn't allow the window to be maximized in the first place.
Press Alt + Space shortcut keys together on the keyboard to open the window menu. Now, press S. The mouse cursor will turn into a cross with arrows. Use the left, right, up and down arrow keys to resize your window.
Press Alt + Spacebar to open the window's menu. If the window is maximized, arrow down to Restore and press Enter . Press Alt + Spacebar again to open the window menu, arrow down to Size, and press Enter .
Try setting PreferredLaunchViewSize
in your MainPage
's constructor like this:
public MainPage() { this.InitializeComponent(); ApplicationView.PreferredLaunchViewSize = new Size(480, 800); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; }
As @kol also pointed out, if you want any size smaller than the default 500x320, you will need to manually reset it:
ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(200, 100));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With