How to customize specific cell while another cell value is changing
Environment
Product Version | Product | Author |
---|---|---|
2021.1.223 | RadGridView for WinForms | Nadya Karaivanova |
Description
This article will demonstrate how you can customize a specific cell depending on the changing value in another cell. For example if there is a calculated column in the grid, the calculated cell always change its value when one of the depending on it cells changes its value. You may want to indicate the user somehow that the value in the calculated cell is about to be changed. This example shows how you can color a cell when another cell in being edited in a way to indicate that its value would change, and after edit, reset the color to its default one.
Solution
To achieve this, we can use the Style property that GridViewCellInfo offers. The GridViewCellInfo.Style property gives direct access to the cell’s visual properties and allows to customize it. We should subsribe to the CellEditorInitialized event and set the desired cell style. Then, reset it in the CellEndEvent event.