title: WPF c# SendKeys to another Windows
body: <p>I want to send Keys, from a WPF, to another Window (e.g. editor)</p>
  
  <p>I found this Methode</p>
  
  <pre><code>public static class SendKeys
  {
      public static void Send(Key key)
      {
          if (Keyboard.PrimaryDevice != null)
          {
              if (Keyboard.PrimaryDevice.ActiveSource != null)
              {
                  var e1 = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.Down) { RoutedEvent = Keyboard.KeyDownEvent };
                  InputManager.Current.ProcessInput(e1);
              }
          }
      }
  }
  </code></pre>
  
  <p>, but it doesn't work :/</p>
  
  <p>so I call it from my main program</p>
  
  <blockquote>
    <p>SendKeys.Send(Key.D7);</p>
  </blockquote>
  
  <p>In this case is WindowsForms not an alternative :/</p>