Skip to main content
All docs
V26.1
  • GridTextAlignment Enum

    Lists values that specify how text in a cell or header is aligned.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v26.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public enum GridTextAlignment

    Members

    Name Description
    Auto

    Aligns the text based on cell content and column data type.

    Left

    Aligns cell text to the left.

    Center

    Centers cell text.

    Right

    Aligns cell text to the right.

    Remarks

    Use one of the following properties to align text in data cells or column captions:

    The following code snippet aligns content of a selection column to the right:

    @using Microsoft.EntityFrameworkCore
    @inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
    @implements IDisposable
    
    <DxGrid Data="GridDataSource">
        <Columns>
            <DxGridDataColumn FieldName="ProductName" />
            <DxGridDataColumn FieldName="UnitPrice"
                              TextAlignment="GridTextAlignment.Left" />
            <DxGridDataColumn FieldName="QuantityPerUnit"
                              TextAlignment="GridTextAlignment.Center" />
            <DxGridDataColumn FieldName="UnitsInStock" />
            <DxGridSelectionColumn Width="80px" TextAlignment="GridTextAlignment.Right" />
        </Columns>
        <TotalSummary>
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" />
        </TotalSummary>
    </DxGrid>
    
    @code {
        IEnumerable<object> GridDataSource { get; set; }
        NorthwindContext Northwind { get; set; }
    
        protected override void OnInitialized() {
            Northwind = NorthwindContextFactory.CreateDbContext();
            GridDataSource = Northwind.Products.ToList();
        }
    
        public void Dispose() {
            Northwind?.Dispose();
        }
    }
    

    The Grid's column text alignment

    See Also