This sample demonstrates the binding of a GridDataBoundGrid (GDBG) with custom collections. The GDBG can be bound to any collection derived from the IList interface.
In this sample, the customer list is derived from the IBindingList. This gives you additional control over adding, editing, and removing records from a list. The customer list itself contains references to the nested objects. These child nodes can be expanded or collapsed inside the grid.
This sample also demonstrates having unbound columns with the customer-objects fields.
Features
The sample is implemented with two unbound columns along with bound columns.
“Unbound1” concatenates the customer’s ID, first name, and last name. “Unbound2” shows the record's position in the collection. These columns are added to the grid in the Form_Load event handler.
The RecordObjectBinder class is a helper class that populates the unbound columns. It subscribes to QueryCellInfo in order to display the unbound column values in the grid.
The Customer class implements the IRecordObject interface, which has a QueryCellInfo method. The QueryCellInfo method is used to provide the values for the unbound columns for each customer object. RecordObjectBinder’s GridModelQueryCellInfo calls this method to populate the unbound column fields.