Skip to main content

DxCheckBox<T>.ValueIndeterminate Property

Specifies the value that corresponds to the checkbox’s indeterminate state.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public T ValueIndeterminate { get; set; }

Property Value

Type Description
T

The value that corresponds to the checkbox’s indeterminate state.

Remarks

The <DxCheckBox> component supports predefined data types whose values define all checkbox states: checked, unchecked, and (optionally) indeterminate. The Checked property defines the current checkbox state. See this property’s description for the complete list of predefined data types.

If the Checked property has a custom data type (Enum, Object, etc.), you should explicitly specify how to consider property values. To do this, use the following properties:

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

if a value is not equal to the specified properties, it is considered as the indeterminate state.

The following example demonstrates how to bind <DxCheckBox> to an Enum object.

<DxCheckBox @bind-Checked="@Value" AllowIndeterminateStateByClick ValueChecked="@Opinion.Yes" 
            ValueUnchecked="@Opinion.No" ValueIndeterminate="@Opinion.Abstain">@GetText()</DxCheckBox>
<DxCheckBox Checked="Opinion.Yes" Enabled="false" ValueChecked="@Opinion.Yes" 
            ValueUnchecked="@Opinion.No" ValueIndeterminate="@Opinion.Abstain">Disabled Checked</DxCheckBox>
<DxCheckBox Checked="Opinion.No" Enabled="false" ValueChecked="@Opinion.Yes" 
            ValueUnchecked="@Opinion.No" ValueIndeterminate="@Opinion.Abstain">Disabled Unchecked</DxCheckBox>
<DxCheckBox Checked="Opinion.Abstain" Enabled="false" ValueChecked="@Opinion.Yes" 
            ValueUnchecked="@Opinion.No" ValueIndeterminate="@Opinion.Abstain">Disabled Indeterminate</DxCheckBox>

@code{
    enum Opinion { Yes, No, Abstain }
    Opinion Value = Opinion.Abstain;

    string GetText() {
        if(Value == Opinion.Yes) return "Checked";
        if(Value == Opinion.No) return "Unchecked";
        return "Indeterminate";
    }
}

CheckBox Enabled

Run Demo: CheckBox - Bind to Custom Data Types

See Also