Skip to main content
A newer version of this page is available. .

DataControlBase.AlternateRowBackgroundPalette Property

Gets or sets a palette used to paint the background of alternate rows. This is a dependency property.

Namespace: DevExpress.WinUI.Grid

Assembly: DevExpress.WinUI.Grid.v22.1.dll

NuGet Package: DevExpress.WinUI

Declaration

[DP(null, Handler = "OnAlternationPaletteChanged")]
public AlternateRowBackgroundPalette AlternateRowBackgroundPalette { get; set; }

Property Value

Type Description
AlternateRowBackgroundPalette

A palette used to paint the background of alternate rows.

Remarks

The GridControl allows you to alternate row colors. To enable row alternation, set the DataControlBase.AlternationCount property to an alternate row frequency. Use the DataControlBase.AlternateRowBackground property to set the background color of alternate rows. You can also use the AlternateRowBackgroundPalette property to specify a palette of row background colors.

WinUI Data Grid - Alternate Row Background Palette

<dxg:GridControl x:Name="grid" AlternationCount="1" .../>
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using DevExpress.WinUI.Grid;

public sealed partial class MainWindow : Window {
    // ...
    public MainWindow() {
        // ...
        AlternateRowBackgroundPalette palette = new AlternateRowBackgroundPalette() {
            new AlternateRowBackgroundPaletteItem() { Background = new SolidColorBrush(Colors.LightSlateGray) },
            new AlternateRowBackgroundPaletteItem() { Background = new SolidColorBrush(Colors.LightGray) },
            };
        grid.AlternateRowBackgroundPalette = palette;
    }
}
See Also