There are two (it would seem) idiomatic ways to minimize WPF window in in code:
window.WindowState = window.WindowState.Minimized
The desired behavior is that the windows 11 window minimize animation is seen. The actual behavior is that the window instantly disappears from the screen.
This is for a window with a custom chrome – therefore triggering the behavior from code seems necessary:
<Window WindowStyle="None" AllowTransparency="True Background="Transparent"> <!-- custom windows chrome here --> </Window>
Is this a defect in the WPF desktop pack for .NET 5 (and 6)?
How does one not get the desired behavior without reverting back to default windows with standard chrome? It is not an option to use a WinUI 3.0 window since XAML islands have not been released yet and gradual modernization is needed.
There are some proposed solutions on the web, like:
However, I could not get it to work with a window with a transparent background.
Source: Windows Questions