This example demonstrates how to apply Data Annotation attributes to a data source.
public class Product {
[ReadOnly(true)]
public double UnitPrice { get; set; }
[EnumDataType(typeof(ProductCategory))]
public int Category { get; set; }
[Display(Description = "The amount of currently available product")]
public int Quantity { get; set; }
[DataType(DataType.Text), Display(Order = -1)]
public string Text { get; set; }
[DataType(DataType.MultilineText)]
public string MultilineText { get; set; }
[DataType(DataType.Currency), Range(200, 5000)]
public int Currency { get; set; }
[DataType(DataType.Date)]
public DateTime Date { get; set; }
[DataType(DataType.Time)]
public DateTime Time { get; set; }
}
- DataSource.cs (VB: DataSource.vb)
- Form1.cs (VB: Form1.vb)
- Data Annotation Attributes
- Tutorial: Create and Manage Data in Code and Apply Data Annotation Attributes
(you will be redirected to DevExpress.com to submit your response)