Also I tried to implement a workaround explained in this question, but not succeeded. I need to simply ignore user input if it's greater than Maximum or lesser than Minimum. Or better yet, don't use the control as the storage for the value, have a class that holds these values that is updated when they change.
I've looked at samples using the Numeric Up Down control for Win Forms, and this sample of a Numeric Up Down custom control from Microsoft.
But so far it seems like Numeric Up Down (supported by WPF or not) is not going to provide the functionality that I want.
However you can set as many textboxes on this validation as well. I know this is a bit late but I'm trying to implement this but I keep getting errors. Are there any that are meant to be typed in other than the defaults after you created a class? So here is complete solution which I think is "idiot proof", and if I'm wrong please tell me: Ant that's it. Text Composition Event Args) Handles Detail Text Box. Handled = True End If End If End Sub This is an old question, but I was working with an unbound box for a simple project I was working on, so I couldn't use the standard binding approach.
just add the Preview Text Input="Number Validation Text Box". If you have many Text Boxes than I recommend creating Custom Control that inherits from Text Box, so you can wrap previous Text and numeric TB_Text Changed up in a separate file. Private Sub Detail Text Box_Preview Text Input(By Val sender As Object, By Val e As System. Preview Text Input If _Is ANumber Then If Not Char. Consequently I created a simple hack that others might find quite handy by simply extending the existing Text Box control: This is an old question, but after using some of the solutions here for some time, I developed my own that works well for my MVVM setup.
then if number is not enter by keyboard (example copy a number and paste it) it doesn't work then what event do i need use?