This is a migrated thread and some comments may be shown as answers.

Validation - Support for IDataErrorInfo?

4 Answers 101 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernhard König
Top achievements
Rank 2
Bernhard König asked on 23 Jun 2013, 11:11 PM

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

4 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 27 Jun 2013, 06:30 AM
Hello Bernhard,

Thanks for writing and for your feedback.

We have logged this in our TODO list and we will be researching the case.

Let us know if you have further questions or need assistance.

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Bernhard König
Top achievements
Rank 2
answered on 27 Jun 2013, 10:28 AM
Hi Deyan,

thanks - supporting IDataErrorInfo would be very helpful in TextBox and PasswordBox!

For now, I went with implementing the validation in code-behind and updating the validation state in the ViewModel from there.

Bernhard
0
Carel Lotz
Top achievements
Rank 1
answered on 10 Jun 2014, 09:39 AM
Any further progress on supporting this or INotifyDataErrorInfo out-of-the box?
0
Tsvyatko
Telerik team
answered on 13 Jun 2014, 08:30 AM
Hi Carel,

Thank you for contacting us.

We currently do not provide support for INotifyDataErrorInfo out of the box. Nevertheless, we will consider it in the upcoming release, especially in the light of the Universal apps.

Regards,
Tsvyatko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TextBox
Asked by
Bernhard König
Top achievements
Rank 2
Answers by
Deyan
Telerik team
Bernhard König
Top achievements
Rank 2
Carel Lotz
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or