Is there a way to on screen keyboard auto pop up when user clicks TextBox field on WPF?
If it is possible, can it work across the app?
Asked
Active
Viewed 1,944 times
1

Bhanu Chandra
- 408
- 8
- 26

arti
- 645
- 1
- 8
- 27
2 Answers
1
On TextBox focus you can use
XAML
<TextBox Name="TxtBxName" GotFocus="TxtBxName_GotFocus" />
C#
private void TxtBxName_GotFocus(object sender, RoutedEventArgs e)
{
Process[] pname = Process.GetProcessesByName("notepad");
if (pname.Length == 0)
System.Diagnostics.Process.Launch("osk.exe");
}
to invoke the on-screen keyboard application that comes with Windows
Same way on the lost focus you should terminate the process

Mohit S
- 13,723
- 6
- 34
- 69
-
also check to see if it is already not running, otherwise you will end up running multiple instances if focus is regained multiple times. it would be better to close the process when focus shifts away from textbox – WAQ Dec 09 '15 at 07:56
-
may be silly question, but how do i use it within Focus()? – arti Dec 09 '15 at 07:59
-
it opens small keyboard. I want standard tablet one. – arti Dec 09 '15 at 08:04
-
If you are planing to run the app on the devices it would automatically do when the cursor reaches in the textbox and if in case you are running the app on the windows it is the default keyboard available with the windows which could be used. – Mohit S Dec 09 '15 at 08:06
-
problem is, it doesn't launch touch keyboard on windows 10 tablet when cursor is in textbox – arti Dec 09 '15 at 08:08
-
I think you need to ask the question in little more details. Now the scenario is changed. Lemme see if i can find something for you – Mohit S Dec 09 '15 at 08:12
0
I have put together all your answers and what works for what me is:
private void OpenOSK()
{
try
{
Process.Start("TabTip.exe");
}
catch
{
}
}
private void _textBox_GotFocus(object sender, RoutedEventArgs e)
{
OpenOSK();
}

arti
- 645
- 1
- 8
- 27