StyleContext

Description

A StyleContext represents a context and provides contextual information in order to better style the DataGrid, its components and parts.

Style contexts

At this time, the DataGrid supports the following style contexts:

  • CanvasStyleContext
  • ColumnChooserStyleContext
  • ColumnHeaderCellStyleContext
  • ColumnHeaderRowStyleContext
  • ColumnReorderDropMarkStyleContext
  • ColumnResizeHandleStyleContext
  • ContextMenuStyleContext
  • DataCellStyleContext
  • DataGridStyleContext
  • DataRowStyleContext
  • DraggedColumnHeaderCellStyleContext
  • FilterCellStyleContext
  • FilterEditorElementStyleContext
  • FilterEditorStyleContext
  • FilterRowStyleContext
  • FixedFootersPanelStyleContext
  • FixedHeadersPanelStyleContext
  • FocusSinkStyleContext
  • GroupByPanelElementStyleContext
  • GroupByPanelStyleContext
  • GroupHeaderStyleContext
  • PaginatorStyleContext
  • StatPanelElementStyleContext
  • StatPanelStyleContext
  • TooltipStyleContext
  • ViewportStyleContext

Properties

All types of StyleContext share the following properties.

Property

Type

Description

type

StyleType

The type of component that the StyleContext targets.

part?

string

The key name of the component’s part that the StyleContext targets.

The ColumnHeaderCellStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is represented by the column header cell.

The ColumnResizeHandleStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is located to the left of the resize handle.

The DataCellStyleContext contains the following additional properties.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The column that the dataCell represents.

dataItem

RawItem

The data source object associated to the parent row.

isCurrent

boolean

Indicates if the dataCell is in the current state (is the targeted component).

isInvalid

boolean

Indicates if the dataCell is in the invalid state (has validation errors).

isSelected

boolean

Indicates if the dataCell is currently selected.

The DataRowStyleContext contains the following additional properties.

Property

Type

Description

dataItem

RawItem

The data source object associated to the row.

isSelected

boolean

Indicates if the dataRow is currently selected.

isAlternate

boolean

Indicates if the dataRow is an alternate row, so it can be styled differently from the previous or next one.

The DraggedColumnHeaderCellStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is represented by the column header cell being dragged.

The FilterCellStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is associated to the filter cell.

The FilterEditorElementStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is associated to the filter editor element.

The FilterEditorStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition on which the filter editor can define a filter.

The FocusSinkStyleContext contains the following additional property.

Property

Type

Description

location

FocusSinkLocation

Indicates if the focusSink is located as the first or the last element in the DataGrid view.

The GroupByPanelElementStyleContext contains the following additional property.

Property

Type

Description

columnDefinition

ReadonlyColumnDefinition

The columnDefinition that is grouped and is associated to the group by element.

The GroupHeaderStyleContext contains the following additional property.

Property

Type

Description

groupPath

GroupPath

An array representing the path that identifies the group (e.g. Canada, Montreal).

The StatPanelElementStyleContext contains the following additional properties.

Property

Type

Description

field

string

The name of the field on data source objects.

groupPath

GroupPath

An array representing the path that identifies the group (e.g. Canada, Montreal) on which to display a statistic.

statConfiguration

ReadonlyStatConfiguration

The configuration used to display the statistic.

statResult

StatResult

The result of the statistical calculation.

The StatPanelStyleContext contains the following additional property.

Property

Type

Description

groupPath

GroupPath

An array representing the path that identifies the group (e.g. Canada, Montreal) on which to display a statistic.