0

I have 2 TextBoxes. i made my own keyboard so the user uses my keyboard and its etrxa buttons. but when i tap on the textbox to type in it the phone keyboard on my phone emulator pops up. I tried the "PreventKeyboardDisplayOnProgrammaticFocus" but i read that it is only to disable it when the program itself chooses a textbox.

I read that the InputPane can help me disable it but i can't understand how to use it and can't find a way to do it anywhere else.

Can somebody help me i just want the keyboard disabled for specific textboxes or the whole page so when i tap on the textbox it won't pop up.

UPDATE: okay i managed after a lot of thought to do it for my app, i set both the textboxes xaml

    <TextBox IsReadOnly="True" />

so now the keyboard won't show up for that textbox since i "don't want to right" then my buttons depending on 2 flags that indicate wich TextBox is focused they will wright there. But still if someone knows how to disable the keyboard completely it could help, if i am not mistaken on android there is such a thing as disable keyboard for this textbox.

panoukos41
  • 41
  • 9

1 Answers1

0

You can use the TextBox.PreventKeyboardDisplayOnProgrammaticFocus property but you also need to change the focus of your Textbox to Programmatic.

A simple example is:

<TextBox x:Name="myTextBox" PreventKeyboardDisplayOnProgrammaticFocus="True"/>

public MainPage()
{
    this.InitializeComponent();
    timer = new DispatcherTimer();
    timer.Interval = TimeSpan.FromMilliseconds(500);
    timer.Tick += delegate
    {
        try
        {
            myTextBox.Focus(FocusState.Programmatic);
            timer.Stop();
        }
        catch { }
    };
}
no_name
  • 174
  • 1
  • 5