How to: Set the Keyboard Input Scope for Windows Phone

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

4/22/2010


The on-screen keyboard can be used to input text on a Windows Phone, and it is deployed automatically when a TextBox control becomes active. Windows Phone has several context-specific on-screen keyboard layouts that you can use for application development including the keyboard types in the following table:

Keyboard Type

Layout

Default

Standard QWERTY layout

Text

Standard layout with ASCII-based emoticons

E-mail Address

Standard layout with .com and @ keys

Phone Number

Typical 12-key layout

Web Address

Standard layout with .com key and customized Enter key

Maps

Standard layout with a customized Enter key

Search

Semi-transparent layout with a Search and  .com key

SMS Address

Standard layout with easy access to phone number layout

To set the input scope

  1. Open any project and on MainPage.xaml, drag a TextBox control from the Toolbox onto the designer. You can also create a TextBox control directly using the following XAML code. You may position or scale the control based on your preference.

    <TextBox Height="31" HorizontalAlignment="Left" Margin="31,256,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="423" >
                    
    </TextBox>
    
  2. In the XAML code, between the <TextBox></TextBox> tags, add the following code to set the input scope. For this example, the “Url” keyboard layout is selected and a .com key is exposed.

    <TextBox.InputScope>
           <InputScope>
              <InputScopeName NameValue="Url"/>
           </InputScope>
    </TextBox.InputScope>
    

Show: