Styling Rows
Before reading this topic, you might find it useful to get familiar with theTemplate Structure of the GridViewRow.
As ofR3 2018 RadGridViewsupports setting theBackgroundof the selected row and as ofR1 2019 SP1it supports setting theMouseOverBackgroundof the row. More information can be found in theSelectedBackground and MouseOverBackgroundarticle.
In this article we will discuss the following topics:
Figure 1: GridViewRow template structure
Targeting the GridViewRow Element
In order to style all RadGridView rows of an application, you should create an appropriate style targeting theGridViewRowelement.
You have two options:
To create an empty style and set it up on your own.
To copy the default style of the control and modify it.
To learn how to modify the default GridViewCell style, please refer to theModifying Default Stylesarticle.
Example 1: Styling all rows of an application
If you're usingImplicit Styles, you should base your style on theGridViewRowStyle.
Setting RadGridView's RowStyle and AlternateRowStyle
RadGridViewexposes theRowStyleandAlternateRowStyleproperties of typeStyle.GridViewRowelements can be styled by providing an appropriate style for each of these properties.
In order to use theAlternateRowStyle, you should first set theAlternationCountproperty of yourRadGridView. For example, if you want to alternate each second row, you have to set its value to 2.
Example 2: Setting a column's CellStyle
Figure 2: RadGridView with styled rows
Setting RadGridView's RowStyleSelector and AlternateRowsStyleSelector
You could also use RadGridView'sRowStyleSelectorandAlternateRowsStyleSelectorproperties to style rows differently based on a specific condition. More details about how this can be achieved can be found in theRowStyleSelector article.