Skip to main content
A newer version of this page is available. .
Tag

ColumnBase.CellStyle Property

Gets or sets the style of cells displayed within this column. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v19.1.Core.dll

Declaration

public Style CellStyle { get; set; }

Property Value

Type Description
Style

A Style object that represents the style of cells displayed within this column.

Remarks

The CellStyle property specifies the style that groups together properties, resources, and event handlers and shares them between instances of the target type.

Target Type:

The example below demonstrates how to define a CellStyle.

<dxg:GridColumn FieldName="Name">
    <dxg:GridColumn.CellStyle>
        <Style TargetType="dxg:LightweightCellEditor" />
    </dxg:GridColumn.CellStyle>
</dxg:GridColumn>

Note

In versions prior to v18.2, you have to add the CellStyle, specifying the style’s BasedOn property:

<dxg:GridColumn FieldName="Name">
    <dxg:GridColumn.CellStyle>
        <Style TargetType="dxg:LightweightCellEditor" 
               BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}" />
    </dxg:GridColumn.CellStyle>
</dxg:GridColumn>

To specify the styles applied to the column’s data cell displayed within the New Item Row and Auto Filter Row, use the ColumnBase.NewItemRowCellStyle and ColumnBase.AutoFilterRowCellStyle properties, respectively.

The GridControl’s CellStyle property is theme dependent. Create a new style based on the existing cell style to apply a CellStyle. E.g., if you are using the MetropolisDark theme, your style’s BasedOn property should be set to the following value:

<dxg:GridColumn.CellStyle>
    <Style TargetType="dxg:LightweightCellEditor" 
           BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle, ThemeName=MetropolisDark}}"/>
</dxg:GridColumn.CellStyle>

The following code snippets (auto-collected from DevExpress Examples) contain references to the CellStyle property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also