I set the minimum size of window like below code.
No matter how much you change the value, it will not affect the minimum size of window.
It seems like window always have a fixed minimum size, and can not edit it. I think that!
Is there any way to edit the minimum size of window?
public sealed partial class MainPage : Page
{
public MainPage()
{
// Init Main Page
this.InitializeComponent();
ApplicationView.PreferredLaunchViewSize = new Size(1000, 800);
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(700, 500));
}
}
Is there any way to edit the minimum size of window?
The SetPreferredMinSize
method is the correct API to set the minimum size of the window. But there are somethings you need to know.
First, the largest allowed minimum size is (500,500), you are setting it as (700,500) which is larger than the allowed value. Please set smaller values like (400,200).
Second, the preferred minimum size will not be persisted after the app is closed. Please make sure you will set your preferred minimum size on your view first when you start your app.
An example of the code
public MainPage()
{
this.InitializeComponent();
ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(300, 250));
}