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

DxCheckBoxSettings.Alignment Property

Specifies the alignment of the checkbox editor in the edit or pop-up edit form.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(CheckBoxContentAlignment.Default)]
[Parameter]
public CheckBoxContentAlignment Alignment { get; set; }

Property Value

Type Default Description
CheckBoxContentAlignment Default

An enumeration value.

Available values:

Name Description
Default

The component’s content is aligned according to outer styles a user applies.

Left

The component’s content is aligned to the left of the component’s root element.

Right

The component’s content is aligned to the right of the component’s root element.

Center

The component’s content is aligned to the center of the component’s root element.

SpaceBetween

The component’s content uses the justify-content: space-between alignment.

SpaceAround

The component’s content uses justify-content: space-around alignment.

Remarks

When the Grid is in edit or pop-up edit form mode, use this property to align the checkbox horizontally. The Grid aligns the checkbox editor to the left border of the container if the editor’s Alignment property is set to SpaceBetween. If the property is set to SpaceAround, the Grid centers the checkbox within the container.

Note

In edit row mode, the Alignment property has no effect and the checkbox editor is centered within its cell.

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 checkbox alignment at runtime, use the ICheckBoxSettings.Alignment property.

Implements

See Also