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

Validations

3 Answers 84 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Shruti
Top achievements
Rank 1
Shruti asked on 06 Sep 2013, 11:51 AM
Hi,

I wanted to know how can i validate telerik wpf controls for some customs validations in mvvm type of architecture.
Basically i want to validate multiple controls on a button click , store the error messages of validations and display all of them in a pop-up(say sort of validation summary)

Please suggest something
Thanks in advance

Shruti

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 10 Sep 2013, 10:14 AM
Hi Shruti,

 Your controls can be bound to ViewModels which implement IDataErorrInfo interface. On a ButtonClick you have to simply iterate over the ViewModels, check the Errors collection and add the existing errorrs in Dictionaly, List, etc. and later display all errors in other control. 

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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
Shruti
Top achievements
Rank 1
answered on 13 Sep 2013, 12:51 PM
Hi petar,
Thanks for your reply. 
But i had actually implemented ther IdataErrorInfo Interface. But could not understand how to access the Error Messages and store it in a list. It would be really helpful if you could provide with a demmo app.

Thanks  a lot in advance

Shruti
0
Petar Mladenov
Telerik team
answered on 18 Sep 2013, 11:29 AM
Hi Shruti,

 Please check out this post. Customr has Error property of type string. So in your application you will have Customer bound to TextBox, Employee bound to other control, etc. and you can have MainViewModel holding all customers and all employees and all other ViewModels (business objets implementing IDataErrorInfo) and this viewmocel can iterate on these objects and sum their error properties into a list.
We hope this can help you proceed further.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Shruti
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Shruti
Top achievements
Rank 1
Share this question
or