TextBox.PreventKeyboardDisplayOnProgrammaticFocus property

Applies to Windows and Windows Phone

Gets or sets a value that indicates whether the on-screen keyboard is shown when the control receives focus programmatically.


Public Property PreventKeyboardDisplayOnProgrammaticFocus As Boolean

<TextBox PreventKeyboardDisplayOnProgrammaticFocus="bool"/>

Property value

Type: System.Boolean [.NET] | Platform::Boolean [C++]

true if the on-screen keyboard is shown when the control receives focus programmatically; otherwise, false. The default is false.


Set this property to true to prevent the onscreen touch keyboard from showing when focus is programmatically set on a text box. By default, the onscreen touch keyboard is displayed whenever focus moves to an editable text box and the most recent input was generated by touch. This happens whether focus is set programmatically or by user interaction. In some situations, you might not want the keyboard to show when focus is set programmatically. For example, you might want to prevent the keyboard from covering part of your UI until the user is ready to continue their interaction.


Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Controls [C++]



See also




© 2015 Microsoft