Skip to main content

DxCheckBox<T>.CheckType Property

Specifies the checkbox type.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v26.1.dll

Declaration

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

Property Value

Type Default Description
CheckType Checkbox

A CheckType enumeration value.

Available values:

Name Description
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.

<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";
    }
}

CheckBox CheckType Checkbox

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.

<DxCheckBox CheckType="CheckType.Switch" Checked="@Checked" 
            CheckedChanged="@((bool value) => CheckedChanged(value))">Silent Mode</DxCheckBox>
<DxCheckBox CheckType="CheckType.Switch" @bind-Checked="@SubChecked1" Enabled="@Enabled">Enable sound</DxCheckBox>
<DxCheckBox CheckType="CheckType.Switch" @bind-Checked="@SubChecked2" Enabled="@Enabled">Enable vibration</DxCheckBox>

@code{
    bool Enabled { get; set; } = false;

    bool Checked { get; set; } = true;
    bool SubChecked1 { get; set; } = true;
    bool SubChecked2 { get; set; } = false;

    void CheckedChanged(bool value) {
        Checked = value;
        Enabled = !value;
    }
}

CheckBox CheckType Switch With Enabled

Run Demo: CheckBox - Overview Run Demo: CheckBox - Switch Mode

See Also