O'Reilly logo

Pro Silverlight 5 in VB by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data Annotations

Now that you've seen how to improve the error reporting in your forms, it's worth considering a complementary feature that makes it easier to implement the validation rules that check your data. Currently, Silverlight validation responds to unhandled exceptions that occur when you attempt to set a property. If you want to implement custom validation, you're forced to write code in the property setter that tests the new value and throws an exception when warranted. The validation code you need is repetitive to write and tedious to maintain. And if you need to check several different error conditions, your code can grow into a tangled mess that inadvertently lets certain errors slip past.

Silverlight offers a solution with its ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required