Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxCheckBox<T>.ValueUnchecked Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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:

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