Using Input Scope in Windows Phone 7

When the user places the focus on to the textbox, in the Windows Phone 7 , the default keyboard / onscreen keyboard will pop up for the user to touch and type the characters to the textbox.

It is also important that the keyboard can be customized depending on the input the user will be typing or the data type the textbox is associated with.

For example, user may want only numeric fields and some symbols when typing the Phone numbers or text with symbols like (@,.) when entering a email ID .

As a developer, we are not just limited to the Default keyboard layout. We can specify the input scope, which determines the layout of the Keyboard that is used in Software Input panel.  This will help the end user to easily type the required characters even faster.

Setting the Input Scope is very simple and is demonstrated below.The sample Application contains a simple textbox (textBox1) with a title.

When the focus comes to the textbox, the default onscreen keyboard will be displayed as shown in the screenshot below.

It’s time to change the input scope now. In the PhoneApplicationPage_Loaded Event of the Form, I use the following code snippet .

InputScope Keyboard = new InputScope();
InputScopeName ScopeName = new InputScopeName();
ScopeName.NameValue = InputScopeNameValue.Digits;
textBox1.InputScope = Keyboard;

When I run the Application now and the textbox is focused, the Keyboard layout is changed to support digits.

To change the onscreen keyboard to support Url, Change the NameValue to InputScopeNameValue.Url .

ScopeName.NameValue = InputScopeNameValue.Url;

To change the onscreen keyboard to support Url, Change the NameValue to InputScopeNameValue.EmailSmtpAddress.

ScopeName.NameValue = InputScopeNameValue.EmailSmtpAddress;

The Input Scope and InputScopeName Class is part of the PresentationCore.dll Assembly and is found in the namespace System.Windows.Input

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

One Response

  1. pjulien September 22, 2010 Reply
  2. Using Input Scope in Windows Phone 7 | ProgramInDotnet August 1, 2011 Reply

Leave a Reply


Interesting BlogPosts to read

Download - Pokemon Go for for Windows 10 (Third Party app)
Pokemon Go is one of the popular AR games for android and iOS devices and now , the game is made ava...
Open Wordpad from command line in Windows
You can use the command "Write" from command line in Windows to open the WordPad application.D:\>...
Popular cross-platform (android and iOS) to-do list app
In this blog post, we will cover some of the popular to-do list app that is available on different p...