I just finished developing a touch screen kiosk without a physical keyboard. I also found an osk limitation.
With the help of a graphic designer, we created our own keyboard, buttons with a key background, and content (or tag) that corresponds to the button’s intention. Assign most buttons to a common event handler that inserts text into the CaretIndex of the selected control.
Use separate handlers for DEL and ENTER.
For my application, I display a new window with a text field, the desired keyboard (alpha, numeric, etc.), a useful suggestion that prompts the user to enter data and a placeholder that displays the desired format.
It works very well and gives us full control over the user interface.
private void key_Click(object sender, RoutedEventArgs e) { _activeControl.SelectedText = (string)((Control)sender).Tag; _activeControl.CaretIndex += _activeControl.SelectedText.Length; _activeControl.SelectionLength = 0; _activeControl.Focus(); } private void btnDEL_Click(object sender, RoutedEventArgs e) { var ci = _activeControl.CaretIndex; if (ci > 1) { _activeControl.Text = _activeControl.Text.Remove( _activeControl.CaretIndex - 1, 1); _activeControl.SelectionStart = ci - 1; } else if (_activeControl.Text.Length > 0) { _activeControl.Text = _activeControl.Text.Remove(0, 1); } _activeControl.Focus(); } private void btnEnter_Click(object sender, RoutedEventArgs e) {
source share