Open numeric only keyboard in Windows Phone?

Cippo picture Cippo · Mar 13, 2012 · Viewed 23.3k times · Source

How can i set the keyboard to open in number mode or directly open a special numeric keyboard (as in android)??? My goal is to avoid the user to press the little button to toggle letters and numbers everytime before entering the value that may only be a numerical value. I have a textbox that the user needs to edit.Thanks!!!!

Answer

David Ruttka picture David Ruttka · Mar 13, 2012

Set the InputScope to Number.

XAML

<TextBox InputScope="Number" Name="txtPhoneNumber" />

C#

InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();

name.NameValue = InputScopeNameValue.Number;
scope.Names.Add(name);

txtPhoneNumber.InputScope = scope;

Above code snippets taken from this MSDN article which you can review for more information. As Martin added in the comment, you can also see screenshots of the different InputScope options here.