Using the C1FlexGrid Control > Editing Cells > Checkboxes |
By default, the grid displays values in Boolean columns as checkboxes (the type of the column is determined by the DataType property of the Column object). If you don't want Boolean values displayed as checkboxes, set the column's Format property to a string containing the values that should be displayed for True and False values. For example:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
_flex.Cols["bools"].Format = "Yes;No" |
To write code in C#
C# |
Copy Code
|
---|---|
_flex.Cols["bools"].Format = "Yes;No"; |
In unbound mode, you can use the GetCellCheck and SetCellCheck properties to add checkboxes to any cells. The checkboxes will be displayed along with any text in the cell, and you can set their position using the column's ImageAlign property.
There are two types of check boxes: Boolean and tri-state. Boolean check boxes toggle between the CheckEnum.Checked and CheckEnum.Unchecked states. Tri-state check boxes cycle through the settings CheckEnum.TSChecked and CheckEnum.TSUnchecked and CheckEnum.TSGrayed.
If the cell has a check box and the AllowEditing property is set to True, the user can change the state of the check boxes by clicking them with the mouse or by pressing the SPACE bar or ENTER keys.
By default, toggling the value of checkbox with the mouse or keyboard will toggle all selected checkboxes. You can disable this feature using the EditOptions property.