Skip to main content

Data Annotation Attributes

Data Annotation attributes are used for customizing data classes, to specify how data is displayed from a data source, define validation rules, and set relationships between data classes.

The GridControl, TreeListControl, DataLayoutControl and PropertyGridControl recognize Data Annotation attributes, and automatically generate layout and content based on these attributes. These controls support the following attributes from the System.ComponentModel.DataAnnotations library.

  • CreditCardAttribute
  • CustomValidationAttribute
  • DataTypeAttribute
  • DisplayAttribute
  • DisplayFormatAttribute
  • EditableAttribute
  • EnumDataTypeAttribute
  • EmailAddressAttribute
  • FileExtensionsAttribute
  • MaxLengthAttribute
  • MetadataTypeAttribute
  • MinLengthAttribute
  • PhoneAttribute
  • RangeAttribute
  • RegularExpressionAttribute
  • RequiredAttribute
  • ScaffoldColumnAttribute
  • ScaffoldTable
  • StringLengthAttribute
  • UrlAttribute
  • ValidationAttribute

Additionally, the DevExpress.Mvvm.DataAnnotations namespace contains the following attributes for setting masks.

  • DateTimeMaskAttribute
  • NumericMaskAttribute
  • RegExMaskAttribute
  • RegularMaskAttribute
  • SimpleMaskAttribute
  • DefaultEditorAttribute
  • GridEditorAttribute
  • LayoutControlEditorAttribute
  • PropertyGridEditorAttribute


Data Annotation attributes cannot be used to configure automatically generated data classes, for example, WCF Data Services.

You can use the Data Annotation Attributes in POCO View models to implement the IDataErrorInfo interface.

See Also