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.v18.2.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: LightweightCellEditor
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.
Related GitHub Examples
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.