I am new in UWP, I want to hide On screen keyboard which pops up on focus on textbox.I already have numeric pad to accept the input from user. How to avoid keyboard's automatic functionality.
Tried with PreventKeyboardDisplayOnProgrammaticFocus="True" and
InputPane.GetForCurrentView().Showing += (s, e) => (s as InputPane).TryHide();
but no use.
You can set
PreventKeyboardDisplayOnProgrammaticFocuson TextBox toTrue, this can solve your problem.Update
When the user clicks on the TextBox, the
FocusStateof the space is Pointer, not Programmatic, so thePreventKeyboardDisplayOnProgrammaticFocusproperty does not work.This is a Hack method that achieves your purpose through visual spoofing:
code-behind:
As you can see, when
ShowTextBoxis set to ReadOnly, it does not trigger the virtual keyboard. When it gets the focus, we programmatically shift the focus to the "hidden"HideTextBox. At this time, the virtual keyboard will be intercepted. User-entered content can be obtained by binding.It's not perfect, I also look forward to a better way to solve this problem.
Best regards.