arti
arti

Reputation: 657

On Screen Keyboard auto pop up

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?

Upvotes: 1

Views: 2053

Answers (2)

arti
arti

Reputation: 657

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

Upvotes: 0

Mohit S
Mohit S

Reputation: 14064

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

Upvotes: 1

Related Questions