I'm trying to develop and application that utilizes a maximized window on the second monitor.
There's a few issues here. The first is that WPF doesn't offer the same information as WinForms about monitor configuration. WinForms has SystemInformation.MonitorCount and Screen.AllScreens[i].WorkingArea. WPF has SystemParameters.PrimaryScreen[Width/Height] and SystemParameters.VirtualScreen[Width/Height] which almost works (as long as you don't have more than two monitors) but not really. So back to using WinForms API...
Secondly, the obvious solution to display a form maximized on second screen was to me the following:
fullScreenWindow.WindowStartupLocation = WindowStartupLocation.Manual;
Debug.Assert(System.Windows.Forms.SystemInformation.MonitorCount > 1);
System.Drawing.Rectangle workingArea = System.Windows.Forms.Screen.AllScreens[1].WorkingArea;
fullScreenWindow.Left = workingArea.Left;
fullScreenWindow.Top = workingArea.Top;
fullScreenWindow.Width = workingArea.Width;
fullScreenWindow.Height = workingArea.Height;
fullScreenWindow.WindowState = WindowState.Maximized;
fullScreenWindow.WindowStyle = WindowStyle.None;
fullScreenWindow.Topmost = true;
fullScreenWindow.Show();
However, when you try that you'll end up with a topmost maximized window on your primary display, which was not what we wanted.
Turns out that we cannot maximize the window until it's loaded. So by hooking the Loaded event of fullScreenWindow and handling the event along the lines of:
private void Window_Loaded(object sender, RoutedEventArgs e) {
WindowState = WindowState.Maximized;
}
...it works.
Oh, and you want to make certain that you are running a dual monitor configuration so you do not put the window somewhere where it is off-screen.