Skip to content

DevExpress-Examples/winforms-grid-data-annotation-attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Data Grid - Bind to a data source with Data Annotation attributes

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; }
}

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Bind the Grid control to a data source with Data Annotation attributes.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •