0
votes

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.

1
Did you try to override the OnCreateAutomationPeer() method as suggested here?: stackoverflow.com/questions/40845538/…mm8
Making it Disabled(IsEnabled=false) instead of ReadOnly is not an option?3615
@mm8 : Extend TextBox works like a charm. I thought there was an attribute.Speed Neo

1 Answers

1
votes

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);
    }
}