Class GridCheckBoxSelectorCellRenderer
Represents the class that is used for drawing the check box selector cell.
Inheritance
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid.Renderers
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridCheckBoxSelectorCellRenderer : GridCheckBoxCellRenderer, IGridCellRenderer<TableControl>, IDisposable
Examples
The following example shows how to replace the custom check box selector cell renderer.
// Remove the existing check box cell renderer and added the custom check box cell renderer.
sfDataGrid1.CellRenderers.Remove("CheckBoxSelector");
sfDataGrid1.CellRenderers.Add("CheckBoxSelector", new CustomCheckBoxSelectorRenderer());
// Implement custom check box renderer.
public class CustomCheckBoxSelectorRenderer : GridCheckBoxSelectorCellRenderer
{
public CustomCheckBoxSelectorRenderer()
{
}
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
{
base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex);
}
protected override void OnKeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
// To avoid changing state of the check box on Space key.
return;
}
base.OnKeyDown(dataColumn, rowColumnIndex, e);
}
}
Constructors
GridCheckBoxSelectorCellRenderer()
Initializes a new instance of the GridCheckBoxSelectorCellRenderer class.
Declaration
public GridCheckBoxSelectorCellRenderer()
Methods
CanValidate()
Overridden to cancel the validation for GridCheckBoxSelectorColumn.
Declaration
public override bool CanValidate()
Returns
Type | Description |
---|---|
System.Boolean | By default, it returns false. |
Overrides
OnKeyDown(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
protected override void OnKeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
Overrides
OnMouseDown(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when mouse down on the check box cell.
Declaration
protected override void OnMouseDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The data column of the check box cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the check box cell. |
System.Windows.Forms.MouseEventArgs | e | The MouseEventArgs that contains the event data. |
Overrides
OnMouseUp(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when mouse up on the check box selector cell.
Declaration
protected override void OnMouseUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The data column of the check box selector cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the check box selector cell. |
System.Windows.Forms.MouseEventArgs | e | The MouseEventArgs that contains the event data. |
Overrides
OnRender(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Renders the check box cell for the selector column.
Declaration
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | paint | The System.Drawing.Graphics that used to draw the check box. |
System.Drawing.Rectangle | cellRect | The cell rectangle. |
System.String | cellValue | The cell value. |
CellStyleInfo | style | The CellStyleInfo of the cell. |
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |