Reputation: 103
So in UWP, we can use
ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 500));
but
ApplicationView.GetForCurrentView();
returns null in WinUI 3. Is there a way to set the minimum size for a window
Upvotes: 4
Views: 2279
Reputation: 1
The recommended solution, implemented on GitHub, is to use P/Invoke to call the window subclassing functions SetWindowSubclass
and DefSubclassProc
:
WM_GETMINMAXINFO
, then forwards any other window messages to the original WndProc, via DefSubclassProc
(or CallWindowProc
in the examples), although note the disadvantages).SetWindowSubclass
(or SetWindowLongPtr
in the examples).This comes from an issue on the XAML GitHub repo.
See this similar question and this other similar question for more info.
Upvotes: 2