The CheckBoxEditor can be used to edit the content of cells which have a boolean datatype.
By default, the CheckBoxEditor will be created as the CellEditorManager for all columns in the grid which have a boolean datatype.
When the CheckBoxEditor is activated, clicking the checkbox area will toggle the value. To allow the value to be toggled regardless of the where the user clicks in the CheckBoxEditor, the FitSizeToCell property must be set to true.
If a CellEditorManager other than the CheckBoxEditor is desired by default for columns which have a boolean datatype, the GridControl's CellEditorManagerMapping property can be modified. For example:
VB.NET | Copy Code |
---|---|
GridControl1.CellEditorManagerMapping( GetType( Boolean ) ) = New CustomBooleanEditor() |
C# | Copy Code |
---|---|
gridControl1.CellEditorManagerMapping[ typeof( bool ) ] = new CustomBooleanEditor(); |
If a different CellEditorManager is required for only one column or cell, the CellEditorManager property of the specific column or cell can be set rather than changing the default CellEditorManager that is created for all boolean columns via the CellEditorManagerMapping property.
VB.NET | Copy Code |
---|---|
GridControl1.Columns( "Arrived" ).CellEditorManager = New CustomBooleanEditor() |
C# | Copy Code |
---|---|
gridControl1.Columns[ "Arrived" ].CellEditorManager = new CustomBooleanEditor(); |
The underlying control wrapped by the CheckBoxEditor control is the WinCheckBox control and is accessible through the TemplateControl property. All settings relating to the underlying control must be accessed via the TemplateControl property. Note that if a cloned instance of the TemplateControl is used to edit (refer to the CreateControlMode property and CreateControl method), the actual control that is used will be a clone of the TemplateControl and not the TemplateControl itself. In this case, the ActivatingControl event can be used to modify the cloned instances.
More information regarding the WinCheckBox control can be found in the WinCheckBox control topic.