The UWP textbox and PasswordBox use the input range to change the touch keyboard inputscope

Source: Internet
Author: User
Tags touch

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.