Skip to main content
A newer version of this page is available. .

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
  • DisplayFormatAttribute
  • EditableAttribute
  • EnumDataTypeAttribute
  • EmailAddressAttribute
  • FileExtensionsAttribute
  • MaxLengthAttribute
  • MetadataTypeAttribute
  • MinLengthAttribute
  • PhoneAttribute
  • RangeAttribute
  • RegularExpressionAttribute
  • RequiredAttribute
  • ScaffoldColumnAttribute
  • ScaffoldTable
  • StringLengthAttribute
  • UrlAttribute
  • ValidationAttribute (currently is not supported by DataLayoutControl)

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

  • DateTimeMaskAttribute
  • NumericMaskAttribute
  • RegExMaskAttribute
  • RegularMaskAttribute
  • SimpleMaskAttribute
  • LayoutControlEditorAttribute

Note

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