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

Posted by Giffyguy on Stack Overflow See other posts from Stack Overflow or by Giffyguy
Published on 2009-08-12T20:31:39Z Indexed on 2010/04/02 23:53 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

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

I've looked at samples using the NumericUpDown control for WinForms, and this sample of a NumericUpDown custom control from Microsoft. But so far it seems like NumericUpDown (supported by WPF or not) is not going to provide the functionality that I want. The way my app is designed, nobody in their right mind is going to want to mess with the arrows. They don't make any practical sense, in the context of my app.

So I'm looking for a simple way to make a standard WPF TextBox accept only the characters that I want. Is this possible? Is it practical?

Thanks, SO!

© Stack Overflow or respective owner

Related posts about input

Related posts about numericupdown