SaguiItay SaguiItay - 3 months ago 16
C# Question

How to programmatically hide the keyboard

I have a textbox with a button inside (Telerik's RadTextBox with an Action configured).
When the user presses the Action, a progress bas is displayed, the screen goes dark, and some magic happens.

My problem is that since the action doesn't result in the textbox losing focus, the on-screen keyboard is not hidden, and keeps covering half the screen.

I would like to programmatically hide the on-screen keyboard, but don't know how.

Answer

Just set focus to the main page:

this.Focus();

this will focus a control that doesn't use the keyboard and thus hide the keyboard. Unfortunately there is no API to the keyboard to hide it.