Back to Devexpress

DxCheckBox<T>.CheckType Property

blazor-devexpress-dot-blazor-dot-dxcheckbox-1-958915e4.md

latest2.4 KB
Original Source

DxCheckBox<T>.CheckType Property

Specifies the checkbox type.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(CheckType.Checkbox)]
[Parameter]
public CheckType CheckType { get; set; }

Property Value

TypeDefaultDescription
CheckTypeCheckbox

A CheckType enumeration value.

|

Available values:

NameDescription
Checkbox

A standard checkbox.

| | Switch |

A toggle switch.

|

Remarks

When the CheckType property is set to Checkbox, the <DxCheckBox> is displayed as a standard checkbox. Users can choose between checked, unchecked, and (optionally) indeterminate states.

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

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

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

Set the CheckType property to Switch to display the <DxCheckBox> as a toggle switch. Users can select between the checked and unchecked states. The indeterminate state is not available in this mode.

razor
<DxCheckBox @bind-Checked="@Value" CheckType="CheckType.Switch">@GetText()</DxCheckBox>
<DxCheckBox @bind-Checked="@Value" CheckType="CheckType.Switch">@GetText()</DxCheckBox>

@code{
    bool Value { get; set; }

    string GetText() {
        if (Value) return "Checked";
        else return "Unchecked";
    }
}

Run Demo: CheckBox - OverviewRun Demo: CheckBox - Switch Mode

See Also

DxCheckBox<T> Class

DxCheckBox<T> Members

DevExpress.Blazor Namespace