Skip to main content

DxCheckBox<T>.ValueUnchecked Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Description
T

The value that corresponds to the checkbox’s unchecked 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 indeterminate.

The following example binds <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