Skip to main content

ICheckBoxSettings.ValueChecked Property

Specifies the value that corresponds to the checkbox editor’s checked state.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
object ValueChecked { get; set; }

Property Value

Type Default Description
Object null

The value that corresponds to the checked state.

Remarks

For predefined data types, a checkbox automatically defines the values that correspond to checked, unchecked, and indeterminate states. If a checkbox editor is bound to a custom data type, you should explicitly specify values that correspond to each checkbox state. Refer to the following topic for more information: Change a Column Editor to Checkbox.

Use the following properties to specify values for checkbox states at runtime:

ValueChecked
Specifies the value that corresponds to the checked state.
ValueIndeterminate
Specifies the value that corresponds to the indeterminate state.
ValueUnchecked
Specifies the value that corresponds to the unchecked state.

All other values correspond to the indeterminate state of the checkbox. If the CheckType property is set to Switch and the indeterminate state is unavailable, such values correspond to the unchecked state.

To specify checkbox state values in markup, use the following properties:

The ICheckBoxSettings interface allows you to get and customize settings of a checkbox editor at runtime. You can get editor settings in the following ways:

  • Call the GetColumnEditSettings method to get editor settings of the column bound to the specified data source field.

    Important

    You need to enclose your code between BeginUpdate and EndUpdate method calls to change values of Grid component parameters outside the Grid component markup. Otherwise, an exception occurs.

    var checkboxSettings = e.Grid.GetColumnEditSettings<ICheckBoxSettings>("Discontinued");
    if(checkboxSettings != null) {
        e.Grid.BeginUpdate();
        checkboxSettings.ValueChecked=State.Yes;
        checkboxSettings.ValueUnchecked=State.No;
        checkboxSettings.ValueIndeterminate=State.Unknown;
        e.Grid.EndUpdate();
    }
    
  • Handle the CustomizeFilterRowEditor event to customize a cell editor in the filter row.
    void Grid_CustomizeFilterRowEditor(GridCustomizeFilterRowEditorEventArgs e) {
        if(e.EditSettings is ICheckBoxSettings checkboxSettings) {
            checkboxSettings.ValueChecked=State.Yes;
            checkboxSettings.ValueUnchecked=State.No;
            checkboxSettings.ValueIndeterminate=State.Unknown;
        }
    }
    
  • Handle the CustomizeDataRowEditor event to customize a cell editor in a data row.
    void Grid_CustomizeDataRowEditor(GridCustomizeDataRowEditorEventArgs e) {
        if(e.EditSettings is ICheckBoxSettings checkboxSettings) {
            checkboxSettings.ValueChecked=State.Yes;
            checkboxSettings.ValueUnchecked=State.No;
            checkboxSettings.ValueIndeterminate=State.Unknown;
        }
    }
    
See Also