Back to Devexpress

DxCheckBox<T>.AllowIndeterminateState Property

blazor-devexpress-dot-blazor-dot-dxcheckbox-1-2f8e9eb2.md

latest2.7 KB
Original Source

DxCheckBox<T>.AllowIndeterminateState Property

Specifies whether the CheckBox supports the indeterminate state.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDefaultDescription
Booleantrue

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:

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

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

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.

razor
<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

DxCheckBox<T> Class

DxCheckBox<T> Members

DevExpress.Blazor Namespace