title: C# WPF detecting multiple pressed keys at the same time
body: <p>I am trying to write a small space shooter game using C# and WPF. I want to be able to move my space ship up and down by keeping my up- or down key, respectively, pressed. That works. However, if I want to fire using the space button, the movement stops although I'd like it to continue. I am using a key event handler that is registered an implemented as follows:</p>
  
  <pre><code>MainWindow.KeyDown += new KeyEventHandler(OnKeyDown);
  
  ...
  
  private void OnKeyDown(object sender, KeyEventArgs e)
  {
      double Shift = 20;
  
      switch (e.Key)
      {
          case Key.Down:
              if (Y &lt; Model.Height - Geometry.Height - Shift)
                  Y += Shift;
              break;
          case Key.Up:
              if (Y &gt; Shift)
                  Y -= Shift;
              break;
          case Key.Space:
              Fire();
              break;
      }
  }
  </code></pre>
  
  <p>Any ideas on how to acomplish what I want?</p>