DxCheckBoxSettings.CheckType Property
Specifies the type of the checkbox editor displayed when the Grid or TreeList is in edit mode.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.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.
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.
Note
The CheckType
property does not affect checkboxes displayed in data cells when the Grid or TreeList is in display mode.
The following code snippet displays a toggle switch at the right side of the edit form’s FormLayoutItem element:
@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.