How to Bind a Scheduler to an ExpressQuantumGrid Using the TcxSchedulerGridConnection
- 2 minutes to read
The following example demonstrates how to bind the ExpressQuantumGrid (the TcxGrid control) to the scheduler using the TcxSchedulerGridConnection component at design-time, so that the grid control can be used in a scheduling application, similar to the Tasks pane in Microsoft® Outlook.
To bind the TcxGrid control to the scheduler via the TcxSchedulerGridConnection component, perform the following operations:
Drop the TcxGrid and TcxScheduler controls, the TcxSchedulerDBStorage (or TcxSchedulerStorage ) and TcxSchedulerGridConnection components onto a form from the Component Palette‘s DevExpress page.
Configure and bind the TcxSchedulerDBStorage (TcxSchedulerStorage) component to the scheduler. To learn how to connect the scheduler storage to the scheduler, refer to the Bound Mode (Unbound Mode) help topic.
By default, the TcxGridDBTableView is available in the grid control. Since the TcxSchedulerGridConnection component uses the TcxGridTableView, delete the TcxGridDBTableView and then create the TcxGridTableView. To do this, right-click the TcxGridDBTableView link in the grid’s Structure Navigator to open the pop-up menu. Click Delete View on the pop-up menu. Then, right-click the TcxGridLevel link, and on the displayed pop-up menu click Create View / Table.
- Select the TcxSchedulerGridConnection component. Using the Object Inspector, bind the scheduler storage component and the grid’s View to the TcxSchedulerGridConnection component via the TcxSchedulerGridConnection.Storage and TcxSchedulerGridConnection.GridView properties, respectively.
- To make the connection between the scheduler and the grid active, set the TcxSchedulerGridConnection.Active property to True. After the connection has been established, the grid automatically creates columns that correspond to the scheduler storage’s fields and populates them with the scheduler’s data.
- If you need to delete unnecessary columns from the grid’s View, use the grid’s Component Editor. To invoke this dialog, click the Customize… button in the grid’s Structure Navigator.
Run the application to see the result.