For Windows 10 UWP apps we have ApplicationView.SetPreferredMinSize() and 500 x 500 limitation for maximum minimum window size. But what about Windows 8.1 apps - is there any similar API to set the minimum width and height of the app window?
It seems like the default minimum height of the blank Windows 8.1 app is noticeably larger then height of the blank Windows 10 UWP app and I can't find where it may be set or changed.
I was wondered is it possible to change this min height and width for them now.
Yeah, we can use reflection to call ApplicationView.SetPreferredMinSize
method at Runtime within Windows 8.1 app to achieve what you want. Following is a simple sample:
var appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
var setPreferredMinSizeMethod = appView.GetType().GetRuntimeMethod("SetPreferredMinSize", new Type[] { typeof(Size) });
if (setPreferredMinSizeMethod != null)
{
setPreferredMinSizeMethod.Invoke(appView, new object[] { new Size(300, 300) });
}
After using this approach, you can change the minimum height and width of your app:
But please note that on Windows 10, Windows 8.1 app's ApplicaitonView is mainly controlled by system. If not necessary, please do not use reflection to do this.