ICheckBoxSettings.Alignment Property
Specifies the alignment of the checkbox editor in the edit or pop-up edit form.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(CheckBoxContentAlignment.Default)]
[Parameter]
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 |
SpaceAround | The component’s content uses |
Remarks
Use the Alignment
property to change checkbox alignment at runtime. To specify the alignment in markup, use the DxCheckBoxSettings.Alignment property.
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 EditRow
and EditCell
edit modes mode, the Alignment
property has no effect and the checkbox editor is centered within its cell.
The ICheckBoxSettings interface allows you to get and customize settings of a checkbox editor at runtime. You can get editor settings in the following ways:
Call the GetColumnEditSettings method to get editor settings of the column bound to the specified data source field.
Important
You need to enclose your code between BeginUpdate and EndUpdate method calls to change values of Grid component parameters outside the Grid component markup. Otherwise, an exception occurs.
var checkboxSettings = e.Grid.GetColumnEditSettings<ICheckBoxSettings>("Discontinued"); if(checkboxSettings != null) { e.Grid.BeginUpdate(); checkboxSettings.Alignment = CheckBoxContentAlignment.Right; e.Grid.EndUpdate(); }
- Handle the CustomizeFilterRowEditor event to customize a cell editor in the filter row.
void Grid_CustomizeFilterRowEditor(GridCustomizeFilterRowEditorEventArgs e) { if(e.EditSettings is ICheckBoxSettings checkboxSettings) checkboxSettings.Alignment = CheckBoxContentAlignment.Right; }
- Handle the CustomizeDataRowEditor event to customize a cell editor in a data row.
void Grid_CustomizeDataRowEditor(GridCustomizeDataRowEditorEventArgs e) { if(e.EditSettings is ICheckBoxSettings checkboxSettings) checkboxSettings.Alignment = CheckBoxContentAlignment.Right; }