honestly - what is common between MVVM and a numeric text field?
if you want the numeric text field to create a new TextBox or AttachedProperty or Behavior. Here is an example of MaskedTextbox behavior to see what I mean.
now to your part of MVVM. I assume that you want your input to be just numeric. if your viewmodel has a property of type int, then your binding just works if your view received an input that can be converted to int. otherwise your viewmodel will never be informed. Now there are 2 ways:
first: you make sure your view can simply accept numerical input (with your numeric text field), and the viewmodel property can be int.
or second: your viewmodel property type is a typeof string, and you use IDataErrorInfo to give an idea when the input is not numeric.
source share