Minimize a window in WPF?

this.WindowState = WindowState.Minimized;

set WindowState = WindowState.Minimized;


For those who had the same problem: keep in mind that if ShowInTaskbar is set to false, then WindowState.Minimized minimizes the Window into a small window title bar at the bottom left of the desktop - so it's not really minimized.

A workaround is to set ShowInTaskbar to true, set WindowState to Minimized and then reset the ShowInTaskbar to its old value.


You are looking for the Window.WindowState property. It is a dependancy property and when changed will set the Window.RestoreBounds property , so you can always restore to the size before the change.

See the enumeration here.

myWindow.WindowState = WindowState.Minimized;