Answered by:
Is InputScope unimplemented for XAML TextBox ?

Question
-
The "Guidelines and checklist for text input (Metro style apps) " say that:
Numeric input Use a TextBox control to enter or edit numbers. Set the InputScope value to InputScopeNameValue.Number.
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh738358.aspx
However
<TextBoxInputScope="InputScopeNameValue.Number" /> gives:
WinRT information: Failed to create a 'Windows.UI.Xaml.Input.InputScope' from the text 'InputScopeNameValue.Number'. [Line: 55 "color:#0000ff;font-face:Consolas;font-size:small;">InputScope="Number"avoids the exception, as per http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.textbox.inputscope.aspx#Y136
but still does not prevent letters being entered into the TextBox.
Should I assume that this is just an unimplemented feature?
Or have other people figured out how to limit the input of characters into a TextBox to be numeric?
Saturday, July 7, 2012 3:55 PM
Answers
-
@Andrew - InputScope doesn't serve as a validator, but rather just a trigger to the keyboard that would be used for the software keyboard when it comes up. To implement validation your app would have to do this in your code.
Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer
(if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)- Proposed as answer by Jesse Jiang Tuesday, July 10, 2012 7:59 AM
- Marked as answer by DavidLambMicrosoft employee, Moderator Wednesday, July 11, 2012 6:50 PM
Saturday, July 7, 2012 6:42 PM
All replies
-
@Andrew - InputScope doesn't serve as a validator, but rather just a trigger to the keyboard that would be used for the software keyboard when it comes up. To implement validation your app would have to do this in your code.
Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer
(if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)- Proposed as answer by Jesse Jiang Tuesday, July 10, 2012 7:59 AM
- Marked as answer by DavidLambMicrosoft employee, Moderator Wednesday, July 11, 2012 6:50 PM
Saturday, July 7, 2012 6:42 PM -
Hmm, then the documentation is missing these concepts entirely. Thanks for pointing me in the right direction though.Saturday, July 7, 2012 6:53 PM
-
I've also forwarded your feedback on the wording to the documentation team for consideration.
Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer
(if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)Saturday, July 7, 2012 7:12 PM