title: Keyboard Input Return Key
body: <p>I am programming a calculator in C#, and I am trying to add keyboard input to it. The problem is if I click a button on the GUI then the Enter/Return key gets focused on that. When the return key is pressed it then clicks that key again, instead of being handled by my KeyDown event handler. How can I fix this?</p>
  
  <pre><code>private void Window_KeyDown(object sender, KeyEventArgs e)
      {
          switch (e.Key)
          {
              case Key.NumPad1:
              case Key.D1:
                  addInput('1');
                  break;
              case Key.Return:
                  MessageBox.Show("Enter!");
                  break;
          }
      }
  </code></pre>