title: WPF full screen on maximize
body: <p>I basically want to have my WPF window to go in full screen mode, when F11 is pressed or the maximize button in the right top corner of the window is pressed.</p>
  
  <p>While the following works like a charm for pressing F11:</p>
  
  <pre><code>private void Window_KeyDown(object sender, KeyEventArgs e)
  {
      if (e.Key == Key.F11)
      {
          WindowStyle = WindowStyle.None;
          WindowState = WindowState.Maximized;
          ResizeMode = ResizeMode.NoResize;
      }
  }
  </code></pre>
  
  <p>This will still displays the Windows taskbar (tested with Windows 7):</p>
  
  <pre><code>protected override void OnStateChanged(EventArgs e)
  {
      if (WindowState == WindowState.Maximized)
      {
          WindowStyle = WindowStyle.None;
          WindowState = WindowState.Maximized;
          ResizeMode = ResizeMode.NoResize;
      }
      base.OnStateChanged(e);
  }
  </code></pre>
  
  <p>What am I missing here? Or can I do it even more elegant?</p>