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 ...

Get Pro Silverlight 5 in VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.