How do I get a TextBox to only accept numeric input in WPF?

后端 未结 30 2367
悲哀的现实
悲哀的现实 2020-11-22 03:40

I\'m looking to accept digits and the decimal point, but no sign.

I\'ve looked at samples using the NumericUpDown control for Windows Forms, and this sample of a Num

30条回答
  •  太阳男子
    2020-11-22 04:03

    Add in a VALIDATION RULE so that when the text changes, check to determine if the data is numeric, and if it is, allows processing to continue, and if it is not, prompts the user that only numeric data is accepted in that field.

    Read more in Validation in Windows Presentation Foundation

提交回复
热议问题