How to Convert a GridViewCheckBoxColumn to a Custom ToggleSwitch Column
Environment
Product Version | Product | Author |
---|---|---|
2022.3.913 | RadGridView for WinForms | Desislava Yordanova |
Description
When RadGridView is bound to a DataSource collection, it automatically generates the columns considering the data type of each field of the source object. Thus, for boolean properties RadGridView generates a GridViewCheckBoxColumn. This article demonstrates how to replace the default GridViewCheckBoxColumn with a custom one that uses RadToggleSwitch.
Default column for boolean properties - "Discontinued"
Solution
It is necessary to create a custom GridViewDataColumn that uses a custom GridDataCellElement containing the RadToggleSwitchElement for managing the boolean property:
Custom ToggleSwitch column - "Discontinued"