I have an small application in WPF with two textBox. One of them must show the Touch Keyboard when it gets focus. It is works correclty using the next code:
Process theTouchKeyboardProcess = null;
...
private void textBoxA_GotFocus(object sender, RoutedEventArgs e)
{
theTouchKeyboardProcess = Process.Start(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");
}
The problem is that I want to hide the touch keyboard when the another one textBox gets focus. I have tried to do this:
private void textBoxA_LostFocus(object sender, RoutedEventArgs e)
{
try
{
theTouchKeyboardProcess.Kill();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
But It launches an exception.
The question is, What is the best way to do this correcty?
Thanks.