i have a textbox which is not bound.
<TextBox x:Name="inputBox" Grid.Column="1" Grid.Row="1" />
The textbox is to only accept numbers (doubles) and show a warning at once something else(letters or symbols) is written in to the box.
On the TextChanged event, i do some calculations depending on the value enterd and show it in a TextBlock, therefor i need some way of validating that the input is a number as the user writes in the box, but i am having a hard time finding a good way to do this.
Any ideas?
What I have used before is a regex to disallow non-numeric characters. Maybe this is something that could be adapted?
My code was for a port on a server so only numbers but should be straightforward to add the . for doubles (I think “[^0-9\.]” should work but regexs aren’t something I am fantastically good at 🙂 )