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:
- In optimized mode: DevExpress.Xpf.Grid.LightweightCellEditor
- In unoptimized mode: CellContentPresenter
The example below demonstrates how to define a CellStyle.
XAML |
<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 NewItemRowCellStyle and 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:
XAML |
<dxg:GridColumn.CellStyle>
<Style TargetType="dxg:LightweightCellEditor" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle, ThemeName=MetropolisDark}}"/>
</dxg:GridColumn.CellStyle>
|
Note
Starting from v18.2, you can add the CellStyle without specifying the style's BasedOn property.