concept attribute in category silverlight

appears as: ttributes, n attribute, attributes, ttribute, attribute, The attribute
Silverlight 4 in Action: Silverlight 4, MVVM, and WCF RIA Services

This is an excerpt from Manning's book Silverlight 4 in Action: Silverlight 4, MVVM, and WCF RIA Services.

Validation, covered in chapter 13, was one of the biggest new features for business applications. Silverlight didn’t add just validation but included support for validation through attributes, validation through exceptions, and even asynchronous validation, all of which work with the Silverlight controls. Silverlight even made it possible to completely customize the style of the validation information provided to the end-user.

Though you can continue to code validation directly into properties setters or use interfaces, the System.ComponentModel.DataAnnotations assembly and namespace found in the Silverlight SDK provide a number of attributes designed to make data validation and display hinting easier for controls such as the DataForm, DataGrid, and some third-party controls. The approach taken by these attributes is to mark up the properties in your entities using attributes in code rather than require code within the properties or external to your entities.

If your scenario supports their use, validation attributes are simple to implement and easy to use. In our discussion of these attributes, we’ll first go over the available set of attributes and how to implement a select set of them in your own classes. Then, we’ll extend the reach of the attributes to call out to external validation functions in your code. Finally, we’ll create our own custom validators to handle situations not easily handled by the built-in set. All of these techniques help us create validation code that’s cleaner and easier to read than many of the other methods.