In my UWP app I'd like to set a minimum window size so that the window cannot be made smaller than that size.
Everywhere that I searched, it seems that using ApplicationView.PreferredLaunchViewSize
is the way to go but for some reason this is not working in my app.
I created a blank UWP app and updated the OnLaunched method as below:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
ApplicationView.PreferredLaunchViewSize = new Size(1200, 900);
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(800, 600));
...
}
My App launches at the correct size of 1200 x 900 but I can shrink the window smaller than the limit of 800 x 600 which I've set for the app.
What is the right way to limit the window size so that it can't get smaller than a certain size ?