Skip to main content

DxCheckBox<T>.AllowIndeterminateState Property

Specifies whether the CheckBox supports the indeterminate state.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(true)]
[Parameter]
public bool AllowIndeterminateState { get; set; }

Property Value

Type Default Description
Boolean true

true if the check mark can be set to the indeterminate state; otherwise, false.

Remarks

The DxCheckBox<T> component can have three states (checked, unchecked, and indeterminate) if the Checked property is bound to the String, Nullable Boolean or custom data type. The indeterminate state is activated when the bound variable value is null. To allow users to activate the indeterminate CheckBox state by a click, set the AllowIndeterminateStateByClick property to true.

The following example activates the CheckBox’s indeterminate state in code:

<DxCheckBox @bind-Checked="@Value">CheckBox Item</DxCheckBox>
<DxButton Click="(e) => ChangeCheckBoxState()">Set to NULL</DxButton>

@code {
    bool? Value = true;
    void ChangeCheckBoxState() {
        Value = null;
    }
}

Indeterminate state is allowed

If the CheckBox bound value has the Nullable Boolean, String, or custom data type, and the AllowIndeterminateState property is set to false, the indeterminate state is not allowed. The CheckBox always skips the indeterminate state when a user switches between checked and unchecked states, and the AllowIndeterminateStateByClick property has no effect.

<DxCheckBox @bind-Checked="@Value" AllowIndeterminateState="false">CheckBox Item</DxCheckBox>
<DxButton Click="(e) => ChangeCheckBoxState()">Set to NULL</DxButton>

@code {
    bool? Value = true;
    void ChangeCheckBoxState() {
        Value = null;
    }
}

Run Demo: CheckBox - Overview

See Also