What is the purpose of the CheckBoxOptions property in WinForms GridControl?
Purpose of the checkbox option
The CheckBoxOptions.CheckedValue specifies
the value to be given in the CellValue to check the checkbox,
that is, either 1 or true. For example, when you
want true to be checked and false to be
unchecked.
By using GridModel
// Change cell type to CheckBox
this.gridControl1[2, 3].CellType = "CheckBox";
// Set the values for ChekedValue and UncheckedValue
this.gridControl1[2, 3].CheckBoxOptions.CheckedValue = "true";
this.gridControl1[2, 3].CheckBoxOptions.UncheckedValue = "false";
// Set the CellValueType as bool.
this.gridControl1[2, 3].CellValueType = typeof(bool);
// set CellValue as true;
this.gridControl1[2, 3].CellValue = true;
// Add the description to the checkBox
this.gridControl1[2, 3].Description = "Click Me";' Change cell type to CheckBox
Me.gridControl1(2, 3).CellType = "CheckBox"
' Set the values for ChekedValue and UncheckedValue
Me.gridControl1(2, 3).CheckBoxOptions.CheckedValue = "true"
Me.gridControl1(2, 3).CheckBoxOptions.UncheckedValue = "false"
' Set the CellValueType as bool.
Me.gridControl1(2, 3).CellValueType = GetType(Boolean)
' set CellValue as true;
Me.gridControl1(2, 3).CellValue = True
' Add the description to the checkBox
Me.gridControl1(2, 3).Description = "Click Me"By using the QueryCellInfo event
void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(e.RowIndex==2 && e.ColIndex == 4)
{
//Change cell type to CheckBox
e.Style.CellType = "CheckBox";
// Set the values for ChekedValue and UncheckedValue
e.Style.CheckBoxOptions.CheckedValue = "true";
e.Style.CheckBoxOptions.UncheckedValue = "false";
// Set the CellValueType as bool.
e.Style.CellValueType = typeof(bool);
// Add the description to the checkBox
e.Style.Description = "Enable";
}
}Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.RowIndex=2 AndAlso e.ColIndex = 4 Then
'Change cell type to CheckBox
e.Style.CellType = "CheckBox"
' Set the values for ChekedValue and UncheckedValue
e.Style.CheckBoxOptions.CheckedValue = "true"
e.Style.CheckBoxOptions.UncheckedValue = "false"
' Set the CellValueType as bool.
e.Style.CellValueType = GetType(Boolean)
' Add the description to the checkBox
e.Style.Description = "Enable"
End If
End Sub Note:
Instead of true and false, you can also set 1 and 0, respectively, to check and uncheck values in a similar way.
The following
screenshot displays the CheckBox cell by using the CheckBoxOptions.

Sample:
Conclusion
I hope you enjoyed learning about the purpose of the CheckBoxOptions property in WinForms Grid Control.
You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!