Declined
Last Updated: 14 Mar 2016 12:08 by ADMIN
Michael
Created on: 10 Mar 2016 01:32
Category: PropertyGrid
Type: Feature Request
0
radpropertygrid validation using "property sets" feature
I understand from http://docs.telerik.com/devtools/wpf/controls/radpropertygrid/features/validation, that there are essentially two methods to implement data validation in a RadPropertyGrid.  Note that I would like to use the "property set" feature of RadPropertyGrid whereby I can display/edit properties from multiple items simultaneously (http://docs.telerik.com/devtools/wpf/controls/radpropertygrid/features/defining-propertysets).

I was only able to get the second validation technique (data annotations) to work when using property sets.  Should the first technique (IDataErrorInfo) work with the property sets feature?  Towards the end of the discussion here http://www.telerik.com/forums/validation-bfd78b274562, this topic is touched on, but it is not clear if it was ever resolved.

If it is not possible to use the IDataErrorInfo technique with property sets, I suggest the documentation at http://docs.telerik.com/devtools/wpf/controls/radpropertygrid/features/validation be updated to reflect this fact.  Separately, is there a target date for when this feature may be added?

If it is possible to use the IDataErrorInfo technique with property sets, would someone kindly post a sample solution?
1 comment
ADMIN
Maya
Posted on: 14 Mar 2016 12:08
RadPropertyGrid exposes PropertySetsValidationFunction property that enable the validation of property sets. It can be used as follows:


 this.rpg.PropertySetsValidationFunction = new Func<string, object, string>((s, t) => { return this.Validate(s, t); });

Where Validate method is: 
public string Validate(string c, object b)
		{
			if (c == "StadiumCapacity" && b != null && (int)b > 100)
			{
				return "StadiumCapacity should be less than 100!";
			}
			else
			{
				return null;
			}
		}

NotifyOnValidationError and ValidatesOnDataErrors properties of the property definitions bindings should be set to true.