Friday, February 19, 2010

Silverlight – my dumb blonde partner.

Reading a book on Silverlight 3.0 right now and can’t stop from getting excited from time to time – how is it possible that with all the validation guidance from WPF and ASP.NET MVC somebody in MS just returned back 10 years and provided a pattern of validation via exceptions for Silverlight??!!image

Can the justification possibly be that it was too much of bytes to incorporate IDataError pattern from WPF? I’m afraid it is a “blond” factor and not amount of bytes behind that design.

Look at this code from Brad Adams’s blog with title “Design Guidelines, Managed code and the .NET Framework” (

        public int EmployeeID
                return this._employeeID;
                if ((this._employeeID != value))
                    ValidationContext context = new ValidationContext(this, null, null);
                    context.MemberName = "EmployeeID";
                    Validator.ValidateProperty(value, context);
                    this._employeeID = value;

And Validator.ValidateProperty(value, context) throws an exception so SL controls can apply templates for invalid data.

Both the code above and design concept are more than ugly (from many viewpoints) and are a huge design step back compared to mvc and wpf. Shame!

Nothing that can’t be worked around / substituted, but the payload of dead bytes from the “dumb blonde” designer will still be there.


Post a Comment