Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF DataGrid MouseOver on DataGridRow

Tags:

I can't figure out why the first part of code isn't working, but the second is.

PART 1

    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
             <Style.Triggers>
                  <Trigger Property="IsMouseOver"
                           Value="True">
                       <Setter Property="Background"
                               Value="Green" />
                  </Trigger>
             </Style.Triggers>
        </Style>
    </DataGrid.RowStyle>

PART 2

    <DataGrid.CellStyle>
        <Style TargetType="DataGridCell">
            <Style.Triggers>
                <Trigger Property="IsMouseOver"
                         Value="True">
                    <Setter Property="Background"
                            Value="Pink" />
                </Trigger>
             </Style.Triggers>
        </Style>
    </DataGrid.CellStyle>

Basically, all I want to do is set the MouseOver color on a row...

like image 216
esylvestre Avatar asked Aug 05 '10 20:08

esylvestre


1 Answers

Dude, I copy-pasted what you have it works perfectly fine for me. I'm not sure what issue you're having. Is there anything else in your XAML that could be relevant? Also, can you try adding a <Setter Property="Background" Value="Transparent"/> to your DataGridRow's style and see if it fixes it?

like image 61
ASanch Avatar answered Sep 17 '22 12:09

ASanch