We can minimize a WPF/WinForm window from code behind file using below code
WinForm:
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
WPF:
this.WindowState = System.Windows.WindowState.Minimized
this.WindowState = System.Windows.WindowState.Maximized
FormWindowState/WindowState are enumerations which specifies how a form window is displayed. Avalialbe members of enum are Minimized,Maximized and Normal. Default is Normal(restored).