I'm developing a WPF application with .NET Framework 4.6.2 on Windows 10. With this framework, when a TextBox gains the focus so the keyboard appears. It is nice but how do disable the automatic invocation of this keyboard only on one TextBox ? Indeed, if I set ReadOnly="True" then the keyboard continues to appear.
Asked
Active
Viewed 719 times
0
-
1Did you try to override the OnCreateAutomationPeer() method as suggested here?: https://stackoverflow.com/questions/40845538/disable-virtual-keyboard-in-windows-10-tablet-mode-for-one-application – mm8 Oct 17 '17 at 14:10
-
Making it Disabled(IsEnabled=false) instead of ReadOnly is not an option? – 3615 Oct 17 '17 at 14:36
-
@mm8 : Extend TextBox works like a charm. I thought there was an attribute. – Speed Neo Oct 18 '17 at 07:52
1 Answers
1
You could override the OnCreateAutomationPeer()
method of the TextBox
class as suggested by @Stalker here:
Disable virtual Keyboard in Windows 10 Tablet Mode for one Application
class MyTextBox : TextBox
{
protected override AutomationPeer OnCreateAutomationPeer()
{
return new FrameworkElementAutomationPeer(this);
}
}

mm8
- 163,881
- 10
- 57
- 88