DataViewBase.CellStyle Property
Gets or sets the style applied to data cells displayed within a View. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v19.1.Core.dll
Declaration
Property Value
Type | Description |
---|---|
Style | A Style object that represents the style applied to data cells. |
Remarks
The CellStyle property specifies the style that groups together properties, resources, and event handlers and shares them between instances of the LightweightCellEditor type.
Target Type:
- In optimized mode: LightweightCellEditor
- In unoptimized mode: CellContentPresenter
See the example below.
<dxg:TableView>
<dxg:TableView.CellStyle>
<Style TargetType="dxg:LightweightCellEditor" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}" />
</dxg:TableView.CellStyle>
</dxg:TableView>
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>
NOTE
Starting from v18.2, you can add the CellStyle without specifying the style's BasedOn property.