Maximizing WPF Window to second monitor

So, if you have this in the code behind:

if (System.Windows.Forms.Screen.AllScreens.Length >= Config.ScreenNumber)
{
    System.Drawing.Rectangle screenBounds = System.Windows.Forms.Screen.AllScreens[Config.ScreenNumber - 1].Bounds;
    this.Left = screenBounds.Left;
    this.Top = screenBounds.Top;
}

And this in your XAML file on Window:

<Window WindowState="Maximized" ...

Asuming that Config.ScreenNumber equals 2, it will not position itself on the second screen no matter what you do, it will maximize on your main screen. What helped in the end was to remove the WindowState from the XAML definition and to add Loaded event handler:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    this.WindowState = WindowState.Maximized;
}
Written by Nikola Brežnjak