以下截图,TextBox,在触摸点击后,会自动弹出windows的虚拟键盘。html
如何,禁用键盘的自动弹出?c#
经过调用TapTip.exe或者osk.exe,主动弹出虚拟键盘windows
详细调用可参考:c#调用windows虚拟键盘ide
TextBox在触摸点击后,会自动弹出虚拟键盘,是由于在控件中做了封装。this
处理方案:重写TextBox的方法OnCreateAutomationPeer,返回一个UIElementAutomationPeer而不是AutomationPeer。spa
可能缘由:TextBox自定义实现中返回的是AutomationPeer,而UIElementAutomationPeer继承AutomationPeer,重写了相关键盘属性。code
猜想与HasKeyboardFocusCore属性有关。htm
方案参考:blog
1 /// <summary> 2 /// 禁用自动弹出虚拟键盘的TextBox控件 3 /// </summary> 4 public class TextBoxNoAutoKeyboard : TextBox 5 { 6 protected override AutomationPeer OnCreateAutomationPeer() 7 { 8 return new FrameworkElementAutomationPeer(this); 9 } 10 }
以上参考自:【stackoverflow】“Hide” text box from automatic Win10 keyboard showing继承