Freigeben über


How to: Specify On-Screen Keyboard Layout for a TextBox

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When you use a TextBox control in an application for Windows Phone, you can specify the input scope, which determines the keyboard layout for the software input panel (SIP). This provides the user with easy access to the expected input characters based on the application context.

The following table shows some of the common SIP layouts and the associated values that you specify in XAML or in application code. For application code, the enumeration values are in InputScopeNameValue.

SIP layout

XAML or enumeration value

SIP description

Default

Default, and other standard input scope values

Standard QWERTY layout

Text

Text

Standard layout with features such as autocorrect and text suggestion

Web

Url

Standard layout with .com and customized Enter key for typing URLs.

E-mail address

EmailSmtpAddress

Standard layout with .com and @ key.

E-mail name or address

EmailNameOrAddress

Standard layout with .com and @ key, and easy access to phone number layout.

Maps

Maps

Standard layout with a customized Enter key. Used to type a location to search for on a map

Phone number

TelephoneNumber

12-key layout

Search

Search

Semi-transparent layout with a Search and .com key.

SMS contact

NameOrPhoneNumber

Standard layout with access to phone number layout. Used to type in the SMS To field

Chat

Chat

Text input that uses intelligent features such as abbreviations

Additional standard input scope values are also supported. For most values, the TextBox control displays the standard SIP layout. Some input scope values, such as Numbers, causes Windows Phone to display the first symbol page of the standard SIP layout. In addition, automatic capitalization is enabled on the SIP for some input scope values, where appropriate.

The following examples show how to set the input scope for a TextBox control.

<TextBox Text="HelloWorld">
    <TextBox.InputScope>
        <InputScope>
            <InputScopeName NameValue="Url" />
        </InputScope>
    </TextBox.InputScope>
</TextBox>
InputScope inputScope = new InputScope();
InputScopeName inputScopeName = new InputScopeName();
inputScopeName.NameValue= InputScopeNameValue.Url;
inputScope.Names.Add(inputScopeName);
textbox.InputScope = inputScope;

See Also

Other Resources