This sample demonstrates the display of a data set with multiple nested relations. It displays Northwind’s Category, Products, and the Orders_Details tables, and it lets you expand or collapse the details for each order and the products for each category.
This sample illustrates the display of “of #records” inside the record navigation bar, highlighting the current record, and marking the column header for the current column.
The records of the Products table will be displayed in a quicken-like manner with one record spanning two rows.
Features
Add a relation in the data set and set the data source to the grid; pass RelationName through the Grid.Binder.AddRelation function to show a hierarchical pattern.
Highlighting a record is handled in the PrepareViewStyleInfo handler.
Mark the column header by setting HighlightCurrentColumnHeader property to true. In the picture given above, the "OrderId" is highlighted.
Records of the three tables can be differentiated by setting RowStyles.BackColor of the GridHierarchyLevel class.
To span records, use hyphen "-" for a covered cell and fullstop "." for a new row in the LayoutColumns() function of the GridHierarchyLevel class.
Grid events handled within GridRecordNavigationControl need to be subscribed to in a PaneCreated event handler and unsubscribed in a PaneClosing event handler.
The reason is that as the panes are opened and closed, the original GridControl or the GDBG may be destroyed. So, a one-time subscription cannot be applied to the initial GridControl events.