Formatting System Cells
The CellFormatting event is used to add formatting to grid systems cells: header cells, filter cells and new row cells. Depending on the RowIndex, you can distinguish the system cells:
RowIndex | VirtualGridRowElement |
---|---|
-1 | VirtualGridHeaderRowElement |
-2 | VirtualGridNewRowElement |
-3 | VirtualGridFilterRowElement |
For example, the code sample below changes the ForeColor, BackColor and GradientStyle for the ContactTitle header cell, CompanyName new row cell and City filter cell:
Due to the UI virtualization in RadVirtualGrid, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, sorting and so on. In order to prevent applying the formatting to other columns' cell elements (because of the cell reuse) all customization should be reset for the rest of the cell elements.