DataControlBase.AlternateRowBackgroundPalette Property
In This Article
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.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
[DP(null, Handler = "OnAlternationPaletteChanged")]
public AlternateRowBackgroundPalette AlternateRowBackgroundPalette { get; set; }
#Property Value
Type | Description |
---|---|
Alternate |
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.
<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