Whenever you see demo’s of RIA and Silverlight you come across the new DataForm control. The DataForm control is a completely new type of control in Silverlight 3 that aims to strengthen the of positioning of Silverlight on the line-of-business side of internet application development. You can equate it to a single line datagrid that displays it’s fields vertically, rather than horizontally, thus forming a single record entry form. Actually that is a very simplified description of a really powerful control that works with single object or collection of object, not just RIA ones.
Each field is customizable in type, appearance and editor (like dropdown, calendar or checkbox). You can have separators, you can group fields, have them horizontally, vertically, caption in front or above, and so on. It can also be used in 2 different roles: to display the detail of a single object, of as navigation control for a collection of objects.
Example 1 shows the single object view, which is done by setting or binding the CurrentItem property of the control. Example 2 can navigate a collection because the ItemSource property was bound to a collection. If you use the second you can still control the current item using the CurrentIndex property. You also get navigation, add and delete buttons, if you want them, with events you can handle.
If your objects support the IChangeTracking you automatically get the Save button in edit mode, also implementing the IReversibleChangeTracking will also give you the Cancel button. By default all RIA Entities implement the latter.
Another very nice feature of the DataForm control is the field error summary which is also included.
By Nick Verschueren, .Net Solutions Architect