Chapter 12. Data controls: DataGrid and DataForm
This chapter covers
- Learning about the DataGrid
- Turning the grid on its side with the DataForm
- Controlling binding display through attributes
In chapter 11, we covered binding. I believe binding to be one of the most important topics for Silverlight developers. One reason behind that is because the DataGrid and DataForm, as well as data annotations for display, all require binding in order to be useful.
Silverlight 2 included the DataGrid, and Silverlight 3 added the DataForm to the mix of data-centric controls. The DataGrid provides tabular Excel-like data view and editing. The DataForm is like a DataGrid rotated 90 degrees. Where the DataGrid is all about rows and columns for multiple visible entries, the DataForm is about fields and labels for a single visible entry.
Once we cover the DataGrid and DataForm, we’ll see how to annotate properties with simple attributes to control display within the DataGrid and DataForm. We’ll cover the related validation attributes in chapter 13.
When used together, the DataForm, DataGrid, and data annotations can form the heart of the user interface for any forms-over-data or business application and can save you a ton of implementation time. Of the three, the DataGrid is the most often used, so we’ll start there.