Add two or more controls in one cell in RadGridView
Environment
Product Version | Product | Author |
---|---|---|
2021.1.223 | RadGridView for WinForms | Nadya Karaivanova |
Description
This article will demonstrate how to add one or more controls in one cell in RadGridView (e.g. a progress bar and label).
Solution
This can be done easily by using a custom cell and subscribing for CreateCell event where to replace the default cell with the custom one.
First, let's create our custom GridDataCellElement that contains a RadLabelElement and RadProgressBarElement:
When we finished our work on the custom cell element, now we should associate the cells of the Progress Column with this custom cell type. In order to do so, handle the CreateCell event which is called once for each cell when RadGridView is shown for the first time. When this event is fired for the cells of Progress Column, we set the property CellType of the GridViewCreateCellEventArgs to our custom cell type: