Blogs

The One With

Silverlight Grid Control and Data Annotations – v2010 vol 1

     
AgDataGrid in v2010.1 will introduce support for Data Annotations. This is especially useful if you have adopted .NET RIA Services for your data transport.

In the first release the DataGrid will support the following annotation attributes from System.ComponentModel.DataAnnotations

DisplayAttribute

- Order This will tell the grid the position of the field column

- ShortName & Description Will control the column header and tooltip

- AutoGenerateField If this value is set to false the column will not be shown in the grid when auto generates it’s columns from the data source.

EditableAttribute will control whether an end-user can invoke the in-place editor or not.

Example:

public class Customer {
public string FirstName {
get;
set;
}
public string LastName {
get;
set;
}
[Display(ShortName = "Title", Description = "Title of Courtesy")]
public string TitleOfCourtesy {
get;
set;
}
[Display(ShortName="Post", Description="Postal Code (editing is not allowed)"), Editable(false)]
public string PostalCode {
get;
set;
}
[Display(AutoGenerateField = false, Description="Hidden")]
public string Extension {
get;
set;
}
[ReadOnly(true), Display(Order=0, Description="Identifier")]
public int ID {
get;
set;
}
}

Note: we have also added support for the ReadOnlyAttribute

Cheers,

Azret

Published Apr 09 2010, 03:17 PM by Azret Botash (DevExpress)
Bookmark and Share

Comments

No Comments
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.