Skip to main content
A newer version of this page is available. .
All docs
V23.1

DxCheckBoxSettings.CheckType Property

Specifies the type of the displayed checkbox editor when the Grid is in edit mode.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Default Description
CheckType Checkbox

An enumeration value.

Available values:

Name Description
Checkbox

A standard checkbox.

Switch

A toggle switch.

Remarks

When the CheckType property is set to Checkbox, the checkbox editor looks identical to the standard checkbox. The standard checkbox allows users to switch between checked, unchecked, and indeterminate states.

CheckBox CheckType Checkbox

Set the CheckType property to Switch to display the checkbox editor as a toggle switch. The switch allows users to select between checked and unchecked states. The indeterminate state is unavailable in this mode.

CheckBox CheckType Switch

Note

The CheckType property does not affect checkboxes displayed in data cells when the Grid is in display mode.

The example below demonstrates how to display a toggle switch at the right side of the edit form’s FormLayoutItem element:

Checkbox Settings

@inject ProductService ProductData

<DxGrid Data="@products" PageSize="3">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="ProductName" Width="30%" />
        <DxGridDataColumn FieldName="UnitPrice" />
        <DxGridDataColumn FieldName="UnitsInOrder" />
        <DxGridDataColumn FieldName="Discontinued">
            <EditSettings>
                <DxCheckBoxSettings CheckType="CheckType.Switch" Alignment="CheckBoxContentAlignment.Right"/>
            </EditSettings>
        </DxGridDataColumn>
    </Columns>
    <EditFormTemplate Context="editFormContext">
        <DxFormLayout>
            <DxFormLayoutItem Caption="Product Name:">
                @editFormContext.GetEditor("ProductName")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Unit Price:">
                @editFormContext.GetEditor("UnitPrice")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Units In Order:">
                @editFormContext.GetEditor("UnitsInOrder")
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Discontinued:">
                @editFormContext.GetEditor("Discontinued")
            </DxFormLayoutItem>
        </DxFormLayout>
    </EditFormTemplate>
</DxGrid>

@code {
    private Product[]? products;
    protected override async Task OnInitializedAsync() {
        products = await ProductData.GetData();
    }
}

To change the checkbox type at runtime, use the ICheckBoxSettings.CheckType property.

Implements

See Also