Maximize WPF Window on the current screen Maximize WPF Window on the current screen windows windows

Maximize WPF Window on the current screen


I've included this line on my MainWindow (first control) constructor:

Application.Current.MainWindow.WindowState = WindowState.Maximized;


Because of the taskbar you should use user working area's size:

this.Width=SystemParameters.WorkArea.Width;this.Height=SystemParameters.WorkArea.Height;

You can use this in view's constructor


I am not sure if this is answered yet- I created a sample app with the

WindowStyle = WindowStyle.None;

I created a button and on the click handler did this-

WindowState = WindowState.Maximized

I hooked up the MouseLeftButtonDown handler for the window to drag move-

this.MouseLeftButtonDown += new(MainWindow_MouseLeftButtonDown);private void MainWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){   DragMove();}

When I dragged my window to my second monitor and clicked the maximize button, it maximized in the current window, not the startup window. I was using VS2010 and .NET 4. Let me know if this helps.