I'm trying to bind a property
value to a TextBox
.
The property
is of type int
, and the user can type any text they want.
If the user were to type in a non-numeric value, I can see an exception is thrown in the Output window. This makes sense.
I've added a new control, which inherits from ValidationRule
and I call that instead (which removes the exception). However, it doesn't really help as I don't think I can change the value (the value the user entered).
What I'd like to do within the ValidationRule
is take the bogus value the user entered and remove non valid characters. EG, if they enter 3d
I'd like the d
to be automatically removed. The issue I have is that the signature clearly only returns a ValidationResult
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
Also, is there a way to know which property is being validated. When the code is in the Validate function (shown above), I'd like to know which property is being validated!