[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]MVVM Framework
  [Expand]ViewModels
  [Expand]Commands
  [Expand]Behaviors
  [Expand]Services
  [Expand]DXBinding
  [Expand]MIF
   Converters
   ViewLocator
   Messenger
   Data Annotation Attributes
   LayoutTreeHelper
   Weak Event
 [Expand]Controls and Libraries
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Is this topic helpful?​​​​​​​