What is the best and most concise way to set the minimum, preferred and maximum window sizes in a WinUI 3 application?
Before that, I developed applications in WPF and there were 3 properties that I needed, but this does not seem to be here
Unfortunately, there is no simple way to do this yet.
If you want to do this the hard way, check this issue in the WinUI 3 repo.
But if you want to do this the easy way, just use the WinUIEx NuGet package.
public sealed partial class MainWindow : WinUIEx.WindowEx
{
public MainWindow()
{
this.InitializeComponent();
}
}
<winex:WindowEx xmlns:winex="using:WinUIEx"
x:Class="DesktopWindowExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:DesktopWindowExample"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
MinHeight="200"
MinWidth="100">
<Grid/>
</winex:WindowEx>