コンテキスト:ユーザーがテキストを入力できるように、タッチスクリーンキオスクのオンスクリーンキーボードを使用しています。System.Windows.Input.Keyboard.PrimaryDevice.ActiveSourceがnullになるため、バックスペースボタンが失敗します。
コードコンテキスト:
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");
}
ActiveSourceがnullのKeyEventArgsを使用できず、System.Windows.Forms.SendKeys.SendWait( "{BACKSPACE}")も機能しません。