locked
Disable screen keyboard when textbox get focused

    Question

  • This problem happens in the tablet, when a textbox get focused the screen keyboard will automatically appear, actually I don't want the screen keyboard appear, I have own input method in my app. I tried to set  PreventKeyboardDisplayOnProgrammaticFocus="False" but doesn't works.

    Can anybody help me.

    Sunday, May 11, 2014 10:08 AM

Answers

  • For InputScope you can refer XAML text editing sample.

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Sunday, May 11, 2014 3:30 PM
  • You can't get good behavior by detecting a physical keyboard. Even if there is one you can't tell if the users are using it. They may have one plugged in but pushed off to the side while they use touch.

    You should always accept input from a physical keyboard: if you use TextBlocks instead of TextBoxes you can still get the keyboard input from CoreWindow.CharacterReceived and then route it yourself.

    --Rob

    Monday, May 12, 2014 11:31 PM
    Owner
  • You'll register for CharacterReceived on your CoreWindow object not on the TextBlock. Something like Window.CoreWindow.CharacterReceived += MyCharacterReceivedHandler;

    The character input will be tired to the window not to a specific control so you will need to rout it yourself. You can use the to identify the focused control.

    Tuesday, May 13, 2014 6:51 PM
    Owner

All replies

  • It seems like you cannot disable the on-screen keyboard programmatically. You need to stop the service that controls it. Please refer to the following thread at stackoverflow for more information: http://stackoverflow.com/questions/18745090/disable-on-screen-keyboard
    Sunday, May 11, 2014 10:22 AM
  • I think if you explain what type of input you want and explain full scenario then i can suggest a better solution.

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Sunday, May 11, 2014 1:47 PM
  • Thanks

    But how can I know whether user disable the screen keyboard??

    Sunday, May 11, 2014 2:03 PM
  • My scenario is my text box only accept input numbers, other characters are not allowed, so I don't need the big screen keyboard popup. I just need some number input button in the bottom of screen.

    Sunday, May 11, 2014 2:17 PM
  • There is no way to block the soft keyboard when the user sets focus to a text input control by touch. If you want to force the user to use your buttons for input you can use TextBlocks instead of TextBoxes. You can read the CoreWindow.CharacterReceived event and your buttons to handle keyboard input yourself.

    Given that your app doesn't have a strongly designed layout I'd stick with the default keyboard. Set the InputScope on the TextBoxes to Number so the keyboard will open with the numeric keypad showing.

    --Rob 

    Sunday, May 11, 2014 3:12 PM
    Owner
  • For InputScope you can refer XAML text editing sample.

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Sunday, May 11, 2014 3:30 PM
  • Hi Rob

    I contacted my users and their opinion is if these is a physical keyboard plugged in, app should hide the buttons number keyboard, user could input with the "real" keyboard. But if the keyboard is ejected, the buttons keyboard should appear in the bottom of screen and allow user to tap.

    But the question is how does the app know whether there is a physical keyboard plugged in.

    The good news is my users accepted to use TextBlock instead of TextBox, so the soft keyboard will never appear in the screen, they think the soft keyboard is too big and most of the keys is useless for this app.

    Monday, May 12, 2014 2:25 PM
  • You can't get good behavior by detecting a physical keyboard. Even if there is one you can't tell if the users are using it. They may have one plugged in but pushed off to the side while they use touch.

    You should always accept input from a physical keyboard: if you use TextBlocks instead of TextBoxes you can still get the keyboard input from CoreWindow.CharacterReceived and then route it yourself.

    --Rob

    Monday, May 12, 2014 11:31 PM
    Owner
  • thanks for advice
    Monday, May 12, 2014 11:37 PM
  • Hi Rob

    I want know how to use the CoreWindow.CharacterReceived to receive keyboard events, I tried many way to make TextBlock to receive events but doesn't work.

    Thanks

    Tuesday, May 13, 2014 1:55 PM
  • You'll register for CharacterReceived on your CoreWindow object not on the TextBlock. Something like Window.CoreWindow.CharacterReceived += MyCharacterReceivedHandler;

    The character input will be tired to the window not to a specific control so you will need to rout it yourself. You can use the to identify the focused control.

    Tuesday, May 13, 2014 6:51 PM
    Owner