I have a tablet which has to run an application with numeric input fields. However, I'm having trouble getting the windows keyboard (TabTip.exe) to pop up showing the numeric keypad by default.
The keypad needs to pop up automatically when the text field is clicked on.
I managed to get it to display the keyboard on each field by running TabTip.exe in the TextBox event handler, but it displays the normal keyboard layout. This was using an answer to this question: Show & hiding the Windows 8 on screen keyboard from WPF
protected override void OnStartup(StartupEventArgs eventArgs)
{
// Popup keyboard, Select All on getting focus.
EventManager.RegisterClassHandler(typeof(TextBox), UIElement.GotFocusEvent,
new RoutedEventHandler(GotFocus_Event), true);
EventManager.RegisterClassHandler(typeof(TextBox), UIElement.LostFocusEvent,
new RoutedEventHandler(LostFocus_Event), true);
}
private static void GotFocus_Event(object sender, RoutedEventArgs e)
{
// The popup keyboard.
OpenTouchKeyboard(sender, e);
}
private static void OpenTouchKeyboard(object sender, RoutedEventArgs e)
{
var textBox = e.OriginalSource as TextBox;
if (textBox != null && IsSurfaceKeyboardAttached())
{
var path = @"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe";
Process.Start(path);
textBox.BringIntoView();
}
}
I read in the following page that you can use the text box's "InputScope" property to dictate that it should be a numeric keypad.
So something like <TextBox Header="Name" InputScope="Number"/>
However, this has no effect, it still pops up with the regular layout. Also, I find it hard to believe that the InputScope would just pass itself down to the execution of the TabTip.exe process, without some way of linking them up.
I've also come across this: Start TabTip with numpad view open which suggests editing the registry before each call to TabTip.exe, but this seems very messy and is apparently unreliable in Windows 10.
Isn't there a command line argument or something that can be passed to it?