Validation in silverlight datagrid?
-
Hi I know that we can add the Validator.ValidateProperty call inside the buisness object and decorate it as [Required] like as follows. Reference : http://blogs.msdn.com/b/nagasatish/archive/2009/03/22/datagrid-validation.aspx
\[Required\] public string FirstName { get { return firstName; } set { if (value != firstName) { Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "FirstName" }); firstName = value; NotifyPropertyChanged("FirstName"); } } }
My problem with this approach is that auto generated classes do not contain any validation logic inside them. I am generating the classes from an xsd (XSD2Code utility) and have to use these DTOs because all layers are utilizing them. Silverlight->WCF->Business layer->Data Access layer : All using common DTO classes My questions are : 1. How can I incorporate validations for datagrid entry fields without adding them into plain classes? 2. Is there a way that I can add all these rules in xsd and have them written out inside classes? Please advise. Thanks AJ
Follow your goals, Means will follow you ---Gandhi---