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

Class Validation

1 Answer 20 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
JJ
Top achievements
Rank 1
JJ asked on 30 Jan 2014, 01:01 AM
Hello

I'm using property grid to change an underlying class model.
All my class' properties have data annotations like RequiredAttribute, StringLengthAttribute etc, and my class implements IDataErrorInfo.
In my this[column] indexer of the class I iterate the property to get all attributes related to it and validate all, building the error message accordingly.
When property value change, I raise the INotifyPropertyChanged event and things get going in the UI. Property grid responses well to changes in the model class signaling the errors defined by my attributes annotations. So far so good...

But now I need to implement class level validation rather than only property validation. As mentioned, the last one is working perfectly. I need to implement some feature to signal propertygrid about class level error when, for instance, two date property don't match together.
I tried to add those class level errors in Error member of IDataErrorInfo with no success... allthough the Error property returns an error string, the property grid ignores it and do not show anything. For instance, when using GridView, it signals the entire record when assigning a set of those classes as datasource of the grid... it detects the Error property returning an error message and responds to it... but not propertygrid.

How can I validate class level errors with PropertyGrid?

Best regards,

Jorge

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Feb 2014, 04:38 PM
Hi Jorge,

I am afraid this would not be possible. You can only validate on a property level.

Regards,
Didie
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
PropertyGrid
Asked by
JJ
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or