title: Simulating a Backspace button press in c# with a null ActiveSource
body: <p>Context: We're using an on-screen keyboard on a touch screen kiosk to allow users to enter text.  The backspace button is failing because the System.Windows.Input.Keyboard.PrimaryDevice.ActiveSource becomes null.</p>
  
  <p>Code Context:</p>
  
  <pre><code>if (System.Windows.Input.Keyboard.PrimaryDevice.ActiveSource != null)
  {
      System.Windows.Input.KeyEventArgs ke = 
          new System.Windows.Input.KeyEventArgs(
              System.Windows.Input.Keyboard.PrimaryDevice, 
              System.Windows.Input.Keyboard.PrimaryDevice.ActiveSource,
              0,
              System.Windows.Input.Key.Back);
      ke.RoutedEvent = UIElement.KeyDownEvent;
      System.Windows.Input.InputManager.Current.ProcessInput(ke);
  }
  else
  {
      Console.Out.WriteLine("Problemo");
  }
  </code></pre>
  
  <p>I can't use a KeyEventArgs with a null ActiveSource, and System.Windows.Forms.SendKeys.SendWait("{BACKSPACE}") doesn't work either.</p>