Back to Devexpress

DxCheckBox<T>.AllowIndeterminateStateByClick Property

blazor-devexpress-dot-blazor-dot-dxcheckbox-1-fc86293d.md

latest2.5 KB
Original Source

DxCheckBox<T>.AllowIndeterminateStateByClick Property

Specifies whether users can set the checkbox state to indeterminate.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public bool AllowIndeterminateStateByClick { get; set; }

Property Value

TypeDescription
Boolean

true allows users to select 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.

If the AllowIndeterminateStateByClick property is set to false (the default value), users can change checkbox states in the following order:

Indeterminate (default) → Checked → Unchecked → Checked → Unchecked.

Set the AllowIndeterminateStateByClick property to true to allow users to set the indeterminate state:

Indeterminate → Checked → Unchecked → Indeterminate.

razor
<DxCheckBox @bind-Checked="@Value" AllowIndeterminateStateByClick="true">@GetText()</DxCheckBox>

@code{
    bool? Value { get; set; }

    string GetText() {
        if (Value == true) return "Checked";
        if (Value == false) return "Unchecked";
        return "Indeterminate";
    }
}

Note

The checkbox does not support the indeterminate state if the CheckType property is set to Switch or the AllowIndeterminateState is set to false. In this case, the indeterminate state is considered unchecked.

Run Demo: CheckBox - Customize Layout

See Also

DxCheckBox<T> Class

DxCheckBox<T> Members

DevExpress.Blazor Namespace