Getting Started with WinForms VirtualGrid
The example bellow demonstrates how one can use RadVirtualGrid with a list which contains large amount of data. The example shows how you can use the control events to add or remove rows as well.
In order to use RadVirtualGrid you should add reference to the Telerik.WinControls.GridView assembly.
Setting the form and adding data
1. Add a RadVirtualGrid to a form and set its Dock property to Fill . 2. Add the following sample class to the project.
3. Now you can create the list of objects which will be used as data source. In addition you can create an array that contains the column names.
Using the virtual grid
1. To use the grid you should first specify the count of columns and rows. In addition, you should subscribe to the CellValueNeeded and CellValuePushed events which are used for populating the grid with data and updating the data source when values are changed:
2. Now you can add the CellValueNeeded event handler. In it we will retrieve the cell value and pass it to the grid according to the current row/column index. The event is fired for the header row so you can set the header cells text as well.
3. When a cell value is changed the CellValuePushed event will fire. This will allow you to update the value in the data source:
Add or remove rows
By default the end user can add or remove rows with the UI. When such operation is performed the UserAddedRow or UserDeletingRow events will fire.
The user can delete multiple rows at once.
The following example shows how you can handle the above events and properly update the data source.
Telerik UI for WinForms Learning Resources
- Telerik UI for WinForms VirtualGrid Component
- Getting Started with Telerik UI for WinForms Components
- Telerik UI for WinForms Setup
- Telerik UI for WinForms Application Modernization
- Telerik UI for WinForms Visual Studio Templates
- Deploy Telerik UI for WinForms Applications
- Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)
- Telerik UI for WinForms License Agreement)