问题
We wrote a C#/WPF Application for Touch Devices and have allready implemented our own virtual keyboard. Since windows 10 anniversary (or earlier) we have problems with devices in "Tablet Mode". The default OSK opens whenever a input field is focused.
So the question is: Is it possible to disable the integrated OSK inside our application? If not, is possible to disable the OSK for JUST OUR APPLICATION via registry or settings?
回答1:
I had exactly the same problem. Based on this thread, I managed to disable automatic keyboard (TabTip.exe) invocation by overriding OnCreateAutomationPeer
method of TextBox
:
class MyTextBox : TextBox
{
protected override AutomationPeer OnCreateAutomationPeer()
{
return new FrameworkElementAutomationPeer(this);
}
}
回答2:
As pointed out (and explained) in the comments there is no possibility to disable the OSK just for one application. We solved the problem by disabling the service "Touch Keyboard and Handwriting Panel". Currently it seems to be the only solution, although I'm not fully satisfied. It is - at least in our case - a bearable workaround for tablets and convertibles.
来源:https://stackoverflow.com/questions/40845538/disable-virtual-keyboard-in-windows-10-tablet-mode-for-one-application