Validation - Support for IDataErrorInfo?

5 posts, 1 answers
  1. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 23 Jun 2013 Link to this post


    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
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 27 Jun 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 27 Jun 2013 Link to this post

    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
  5. Carel Lotz
    Carel Lotz avatar
    11 posts
    Member since:
    Aug 2009

    Posted 10 Jun 2014 Link to this post

    Any further progress on supporting this or INotifyDataErrorInfo out-of-the box?
  6. Tsvyatko
    Admin
    Tsvyatko avatar
    832 posts

    Posted 13 Jun 2014 Link to this post

    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.

     
Back to Top
DevCraft banner