This question is locked. New answers and comments are not allowed.
Hi,
I like the nice out-of-the-box Validation Features of the TextBox and PasswordBox controls. Unfortunately it seems that validation can only be done by hand and in code behind.
Isn't it possible to use the standard way of validation by implementing IDataErrorInfo on the bound ViewModel class and having TextBox doing the validation over the binding? Handling validation in code-behind events is very cumbersome when working with bound ViewModels.
I tried it but it doesn't seem to work and the documentation also only shows an example without any bindings.
If it doesn't work, I'd like to place a suggestion to support this. It would be very helpful!
Edit: As an additional info, the behavior I'm observing is:
Textbox: The default indexer property implemented over the IDataErrorInfo interface is called on the initial binding. While I already return an error text here, no validation info is shown. When typing text into it (and also after un-focusing the control as the binding on the TextBox control is only updated after unfocus) the default indexer property is never called again. As soon as the first char is input, the control switches to the green "validated" state.
Passwordbox: The behavior is more correct here: the default indexer property is also called on the initial binding, but also after every char I input. So far so good, but also here: the validation state switches to green/validated as soon as the first char is written and never changes to an validation error hence I always return an error text.
cheers,
Bernhard