Search code examples
.netwpfwindows-10touchscreenon-screen-keyboard

WPF: Invoking onscreen keyboard from a textbox in WebBrowser control on win10


I'm working on a WPF software (using vb) that allows web pages to be opened in a WebBrowser control. The WPF software is run on a tablet in fullscreen mode and Windows onscreen keyboard cannot be invoked separately.

What we've done is first disable wpf tablet support (example here: https://msdn.microsoft.com/library/dd901337(v=vs.90).aspx), and then enable the touch keyboard with focus tracking like so:

Dim Config As InputPanelConfiguration = New InputPanelConfiguration()
Dim ConfigIntf As IInputPanelConfiguration = CType(Config, IInputPanelConfiguration)
If ConfigIntf IsNot Nothing Then
    ConfigIntf.EnableFocusTracking()
End If

This works on a Windows 8 / 8.1 tablets and results in users being able to type input onto text boxes online by tapping on the text box.

Now the problem is Win10 tablets. The same code results in disabling the touch screen completely and the software appears to become "stuck" as the touch screen is not reacting to touches. If I don't disable wpf tablet support first, the onscreen keyboard will not start when tapping on a textbox on a web page within the WebBrowser control.

Partly, it's a browser feature. If I use IE or Edge directly on a Win10 tablet and tap on a textbox, nothing happens (when there is no physical keyboard attached). In Chrome, the onscreen keyboard is automatically opened.

Can anyone here suggest a good way to induce the osk to open whenever a Win10 user taps on a textbox on a web page opened in a WPF WebBrowser control? (doesn't matter if it's C#, VB or irrelevant of language)


Solution

  • Well, so far I did not find a software solution, but I did solve my problem via Windows settings:

    http://www.windowscentral.com/auto-display-touch-keyboard-windows-10-desktop-mode

    There's a setting that controls if the osk will open automatically.