Table of Contents

DataGridView columns

DataGridViewExCheckBoxColumn and DataGridViewExComboBoxColumn are DataGridView columns whose cells draw like ExCheckBox and ExComboBox in the custom style.

Columns

Both columns derive from the WinForms columns (DataGridViewCheckBoxColumn, DataGridViewComboBoxColumn), so data binding, Items, DataSource and ThreeState work as usual. The properties of the column are copied to its cell template and to the cells of the existing rows.

Column Properties
DataGridViewExCheckBoxColumn DefaultStyle, BorderColor, MarkColor, SquareBackColor, HighlightColor (box under the mouse)
DataGridViewExComboBoxColumn DefaultStyle, StyleNormal, StyleHighlight, StyleSelected, StyleDisabled, DropDownBackColor, DropDownSelectedBackColor

The combo box cells are edited in a DataGridViewExComboBoxEditingControl, an ExComboBox with the styles of the column.

Theme

The columns implement IThemeable, but DataGridViewColumn isn't a control, so ExThemer doesn't reach them. The handler of the grid applies the theme to them:

ExThemer.Register<DataGridView>((grid, theme) =>
{
    foreach (var column in grid.Columns.OfType<IThemeable>())
        column.ApplyTheme(theme);
    // ... colors of the grid, its headers and cells
});
Theme color Check box column Combo box column
BorderColor Border of the box. Border of the field.
MarkColor Check mark.
PanelBackColor Background of the box. Background of the drop-down list.
ButtonBackColor, ButtonForeColor Field and its button.
HighlightBackColor Box under the mouse. Border under the mouse and in edit, selected row of the list.

The rest of the grid (background, headers, cell styles) is styled by the handler itself, see the example in Themes.

API