# Alternating Rows

## Content

Alternating rows improve [FlexGrid](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.html) readability by applying different visual styles to alternating data rows. This styling helps distinguish adjacent rows and improves navigation in wide or dense datasets.
The feature supports configurable alternation logic, customizable appearance settings, and integration with detail rows.

***

## Alternating Strategy

The [AlternatingStrategy](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingStrategy.html) property determines how alternating rows are calculated.

| Strategy | Behavior | Recommended Usage |
| -------- | -------- | ----------------- |
| [Index](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.GridRowCol.Index.html) | Alternation is applied based on the current row order.<br>Sorting or filtering the data can change the row order and, therefore, the alternating row pattern. | Standard tabular layouts and dynamic sorting/filtering scenarios |
| [DataIndex](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.GridRow.DataIndex.html) | Alternation is based on the underlying data-source index. Striping remains consistent relative to the source data. | Master-detail layouts and detail row scenarios |

***

## Alternating Row Direction

The `AlternatingRows` property specifies whether alternating styling is applied to even or odd rows.

| Value | Description |
| ----- | ----------- |
| `Even` | Applies alternating styling to even rows |
| `Odd` | Applies alternating styling to odd rows |

This setting allows striping direction to be reversed without changing the assigned styles.
Example:

```auto
grid.AlternatingRows = GridAlternatingRows.Odd;
```

![C1WPF Row - Odd alternating rows ](https://cdn.mescius.io/document-site-files/images/3ca88af8-b501-48d7-a446-601c9251a2fb/image-20261006.10645f.png?caption=Odd%20Alternating%20Rows)

***

## Appearance Customization

Alternating row appearance is configured through dedicated styling properties.

| Property | Description |
| -------- | ----------- |
| [AlternatingRowBackground](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowBackground.html) | Background color for alternating rows |
| [AlternatingRowForeground](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowForeground.html) | Text color for alternating rows |
| [AlternatingRowHeaderBackground](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowHeaderBackground.html) | Background color for alternating row headers |
| [AlternatingRowHeaderForeground](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowHeaderForeground.html) | Text color for alternating row headers |
| [AlternatingRowStyle](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowStyle.html) | Style applied to alternating row cells |
| [AlternatingRowHeaderStyle](/componentone/api/wpf/online-flexgrid/dotnet-api/C1.WPF.Grid/C1.WPF.Grid.FlexGrid.AlternatingRowHeaderStyle.html) | Style applied to alternating row headers |

Example:

```csharp
grid.AlternatingRowHeaderBackground = alternatingRowHeaderBackground;
grid.AlternatingRowHeaderForeground = alternatingRowHeaderForeground;
```

### Selection and Hover Integration

Alternating row styling integrates with selection and mouse-over states.
Default selection and hover brushes use semi-transparent rendering so that alternating row backgrounds remain visible during interaction.

***

***

## Detail Row Support

`FlexGridDetailProvider` includes the `AlternateDetails` property, which determines whether detail rows participate in alternating-row styling.

| Configuration | Behavior |
| ------------- | -------- |
| Default behavior | Detail rows participate in alternating-row styling |
| `AlternateDetails = false` | Detail rows use standard row styling without alternating-row formatting |
