Original: The TextBox and PasswordBox of the UWP use the input range to change the touch keyboard inputscope
When your app is running on a device with a touch screen, the touch keyboard is available for text input. The system invokes the touch keyboard when the user taps an editable input field, such as a TextBox or PasswordBox. By setting the input range of a text control to match the type of data you expect the user to enter, you can allow users to enter data more quickly in the app. The input range provides a hint to the system about the type of text input the control expects, so that the system can provide a dedicated touch keyboard layout for that input type.
1. Limit the input range of the TextBox
For example: Limit mobile phone number can only enter the number inputscope=, and is 11 digits maxlength= "11"
<textbox x:name="Tbmobile"Inputscope=" Number"Maxlength=" One"placeholdertext="Mobile phone number"margin="0,40,0,10"borderthickness="0"Relativepanel.alignleftwithpanel="True"Relativepanel.alignrightwithpanel="True"/>
Input box for mobile phone number:
2. Because the PasswordBox is special, it cannot be set directly using InputScope, only the code is set in the background, and the InputScope attribute on PasswordBox only supports Password and Numericpin values. Any other values will be ignored.
1 New InputScope (); New inputscopename (); 3 inputscopename.namevalue = inputscopenamevalue.numericpin; 4 InputScope.Names.Add (inputscopename); 5 txtpwd.inputscope = InputScope;
PasswordBox input Box settings numericpin and textbox settings inputscope= "number" effect is the same:
If the inputscope setting on PasswordBox is Password :
For more values, refer to the following values:
UWP Small white One, welcome advice!!
The UWP textbox and PasswordBox use the input range to change the touch keyboard inputscope