microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Proposal: Adding Min / Max Window Size.

Open avdain opened this issue 3 years ago • 7 comments

Proposal: [Max / Min Window Size]

Adding minimum / maximum window size.

Summary

Method to add a minimum / maximum window size.

Rationale

  • Saves time because you don't have to develop your own functions for setting the minimization and maximization of the window.

  • Reduces the complexity of the project as the function is already in existence.

  • Very many software engineers are waiting for this feature, so time can be saved.

Scope

Capability Priority
This proposal will allow developers to accomplish W Must
This proposal will allow end users to accomplish X Should
This proposal will allow developers to accomplish Y Could
This proposal will allow end users to accomplish Z Won't

Important Notes

Open Questions

avdain avatar Jun 29 '22 18:06 avdain

Saves time because you don't have to develop your own functions for setting the minimization and maximization of the window.

Just handle WM_GETMINMAXINFO

castorix avatar Jun 30 '22 15:06 castorix

I know this works, but it would be better if there was a better feature.

avdain avatar Jul 01 '22 02:07 avdain

Saves time because you don't have to develop your own functions for setting the minimization and maximization of the window.

Just handle WM_GETMINMAXINFO

Saves time because you don't have to develop your own functions for setting the minimization and maximization of the window.

Just handle WM_GETMINMAXINFO

If this was the only problem in WinUI, then yes we could live with such a workaround. But this is just yet another issue where you need custom handling. As Avaidn hints at, this should be simple. Such that all developers from now does not have to make workarounds.

MEK3DK avatar Jul 04 '22 13:07 MEK3DK

I agree this feature would be useful. Until that is available, here are some pointers which may help developers looking for a workaround:

  • #2945
  • A helper Window subclass which adds useful functionality including Min/Max size: DesktopWindow

codendone avatar Aug 19 '22 19:08 codendone

Upvoting!

ajsuydam avatar Jun 28 '24 00:06 ajsuydam

Can't belive this is still a thing in 2025, how does microsoft think that such a simple aspect of a window needs so many hoops, how they expect developers would choose WinUI3 when is so cumbersome to do stuff

roberto-gigli avatar Jun 03 '25 00:06 roberto-gigli

Can't belive this is still a thing in 2025, how does microsoft think that such a simple aspect of a window needs so many hoops, how they expect developers would choose WinUI3 when is so cumbersome to do stuff

In v1.7 you can access this api

https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel#new-appwindow-apis

PreferredMinimumWidth/Height
PreferredMaximumWidth/Height

And this issue can be closed @RDMacLachlan

ghost1372 avatar Jun 03 '25 09:06 ghost1372

Can't belive this is still a thing in 2025, how does microsoft think that such a simple aspect of a window needs so many hoops, how they expect developers would choose WinUI3 when is so cumbersome to do stuff

In v1.7 you can access this api

https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel#new-appwindow-apis

PreferredMinimumWidth/Height
PreferredMaximumWidth/Height

And this issue can be closed @RDMacLachlan

Now It seems that we can use if(AppWindow.Presenter is OverlappedPresenter presenter) { presenter.PreferredMinimumWidth = 800; presenter.PreferredMinimumHeight = 600; } in MainWindow set minimumsize. :)

haijialiu avatar Aug 29 '25 01:08 haijialiu