Class Structure in Windows Forms GridGrouping (GridGroupingControl)
28 Apr 2021 / 3 minutes to read
This walkthrough will explain the classes that are available in GridGroupingControl which plays a major role for the creation of GridGroupingControl.
The GridGroupingControl class is derived from Control class and implements several interfaces that add Grouping support to this class. It provides support for displaying ADO.NET data and other data sources in a grid.
Data will be loaded from the given data source and changes will be written back to the data source. It is the ideal choice if you need grouping support, multi-column sort support, or true nested-table hierarchical support in a grid. It can be bound to any IList data source.
GridTableControl is the main element in GridGroupingControl. The
GridTableControl displays the rows from the DisplayElements collection of the Table using schema information stored in the TableDescriptor.
TableDescriptor gives access to table schema information of the root table in data source.
TableDescriptor object is instantiated by GridEngine class and initialized with default schema information from the list assigned to data source.
There is only one
GridEngine object for GridGroupingControl.
GridTable objects on the other side can be more than one when hierarchies are displayed. For each hierarchy level,
GridTable are initialized. For example, if you have ADO.NET DataSet with three tables: Products, Orders, and OrderDetails, there will be three
Relations between tables are defined with GridTableDescriptor.Relations collection of TableDescriptor. Each
TableDescriptor can have one or multiple RelationDescriptor objects.
RelationDescriptor defines foreign key columns in the parent table, a child with information about related child table and primary key columns in the child table.
GridTable object is instantiated by
GridEngine class. Table object manages records from the engine’s data source and provides access to records and grouped elements through several collection classes.
The most important collection used by GridTableControl is
DisplayElements collection. This collection provides GridTableControl with information on which element to display at a row. It returns elements such as CaptionSection, RecordRow, SummaryRow, and others. Based on the elements returned by this collection,
GridTable control will display a record, summary, or group caption bar.
The GridGroupDropArea class implements a control that is bound to a GridTableDescriptor. It lets the user drag and drop column headers into its bounds and change the Syncfusion.Grouping.TableDescriptor.GroupedColumns at runtime.
GridGroupDropArea property gives access to the hosted GridGroupDropArea control. Its purpose is to allow dragging header columns from the GridTableControl for user-interactive grouping of records. You can hide and show this area with the ShowGroupDropArea property.
The RecordNavigationBar allows you to display the current record fields and arrow buttons that leads you to change the records.
Engine is the main object of the GridGroupingControl. It contains TableDescriptor with schema information such as fields, relations and Table with runtime representation of data source with groups, records, data, and display elements. The engine lets you set the main data source for the whole engine. TableDescriptor will pick up ItemProperties (schema information) from the data source and table will be initialized at runtime with records from the list.
GridEngineBase class adds design-time support for engine class. It can be dropped as a component into the component tray of the designer. It can be initialized with BindingContext so that the CurrencyManager can be kept synchronized.
GridEngine class adds plumbing for displaying the data in GridGroupingControl. You can specify the data source using DataSource and DataMember properties through the designer. It is instantiated with virtual GridGroupingControl.CreateEngine method. If you want to customize the engine object, you should subclass this class and should overrideCreateEngine method.
GridEngine object is the main grouping engine object. It is derived fromSyncfusion.Grouping.Engine base class and adds Windows Forms specific functionality such as support for
GridEngine also has special overrides of virtual Engine.CreateTableDescriptor and Engine.CreateTable methods so that the grid-specific derived
GridTable class and
GridTableDescriptor class are instantiated.