title: How can I use Window.ShowActivated = false with Maximized window?
body: <p>I have an application that has a splash screen shown before I create my main window. I want to avoid the main window stealing the focus when it gets created if the user has focused another application while the splash screen was shown.</p>
  
  <p>My application's startup looks like this:</p>
  
  <pre><code>private void Application_Startup(object sender, StartupEventArgs e)
  {
      SplashScreenService.Start();
  
      // Initializing stuff...
      ...
  
      // Ready to open the main window.
      MainWindow mainWindow = MainWindow();
      mainWindow.ShowActivated = SplashScreenService.HasFocus();
      mainWindow.ShowDialog();
  }
  </code></pre>
  
  <p>To prevent the main window from getting activated, I'm setting <code>Window.ShowActivated</code> to <code>false</code>, only if the splash screen has lost the focus. But this causes an exception:</p>
  
  <blockquote>
    <p>InvalidOperationException: Cannot show Window when ShowActivated is false and WindowState is set to Maximized.</p>
  </blockquote>
  
  <p>Indeed, my MainWindow sets the <code>WindowState</code> to <code>Maximized</code> (restored from previous session settings). I don't understand why there is such a limitation with the <code>ShowActivated</code> feature. I couldn't find any documentation about this issue.</p>
  
  <p>I tried forcing <code>WindowState</code> to <code>Normal</code> when <code>ShowActivated</code> is false, and it prevents the exception, but it also activates the window! Maybe changing the window state actually causes an activation?</p>
  
  <p>Is there a trick I can use to work around this? I want to restore my main window in a maximized state, and not have the main window steal focus away from other applications if the user has focused away from my app during the splash screen.</p>