Skip to content

Row hover background in DataGrid #3964

@juusimaa

Description

@juusimaa

Bug explanation

When AlternatingRowBackground is used MaterialDesign.Brush.DataGrid.RowHoverBackground does not take precedence over the alternating color.

To reproduce:

    <DataGrid AlternatingRowBackground="Green"
              CanUserAddRows="False"
              CanUserDeleteRows="False"
              IsReadOnly="True"
              ItemsSource="{Binding Numbers}">
        <DataGrid.Resources>
            <SolidColorBrush x:Key="MaterialDesign.Brush.DataGrid.RowHoverBackground" Color="Red" />
        </DataGrid.Resources>
        <DataGrid.Columns>
            <DataGridTextColumn Binding="{Binding .}" Header="Number" />
        </DataGrid.Columns>
    </DataGrid>
public partial class MainWindow
{
    public List<int> Numbers { get; }
    public MainWindow()
    {
        Numbers = Enumerable.Range(0, 100).ToList();
        DataContext = this;
        InitializeComponent();
    }
}

When mouse is over alternating green row background color stays green.

Version

5.3.0

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions