dcary
dcary

Reputation: 325

C# XAML InputScope="Number" present unneeded special characters

I am trying to present only a numeric keyboard. I keep getting the special character region of characters on the left while I would just like to have the num pad region on the right.

(See Image Below)

enter image description here

XAML:

<TextBox x:Name ="EmployeeId" InputScope="Number" />

C#:

var inputScope = new InputScope ();
var inputScopeName = new InputScopeName();
inputScopeName.NameValue = InputScopeNameValue.Number;
inputScope.Names.Add(inputScopeName);
EmployeeId.InputScope = inputScope;

I have read:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.input.inputscopenamevalue.aspx http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn792128 http://msdn.microsoft.com/en-us/library/windows/apps/hh393998(v=vs.105).aspx

I have also searched stackoverflow posts.

Does anyone know how to get my Window RT application to show only the numeric pad. Is what is presented below expected when InputScope is Number, TelephoneNumber or NumberFullWidth?

Thank you. Dan

[Edit Below (possible solution)]

I decided to create a new application and try...

<StackPanel Grid.Row="2" Grid.Column ="0" Grid.ColumnSpan="2"   Width ="300">
        <TextBox Header ="Telephone Number" InputScope="TelephoneNumber"/>
        <TextBox Header ="Pin" InputScope="NumberFullWidth"/>
        <TextBox Header ="Numeric Password" InputScope="Number"/>
        <TextBox Header ="Web site" InputScope="Url"/>
    </StackPanel>

In a Windows Store Application, you get the behavior the picture above. In a Window Phone application you get the results I just the number pad. Bah... It was really simple to recreate.

Upvotes: 5

Views: 3983

Answers (1)

Akash Gutha
Akash Gutha

Reputation: 599

If you want only numbers to be displayed you can use this piece of code

 InputScope="TelephoneNumber"

--please mark the answer if found satisfactory as others with the same problem might find the answer easily.

Upvotes: -1

Related Questions