开发者

How to Change OnHover Background Color of DataGrid Row?

开发者 https://www.devze.com 2023-01-25 08:01 出处:网络
I have a Silverlight DataGrid and I can\'t figure out how to style it.When the user hovers over a row, the background color that is applied to the row (by default) does not fit well with the rest of t

I have a Silverlight DataGrid and I can't figure out how to style it. When the user hovers over a row, the background color that is applied to the row (by default) does not fit well with the rest of the UI. I want to change this backg开发者_如何学运维round color on hover. How do I do it?


You need to assign a DataGridRow Style to DataGrid.RowStyle that changes the animation for the VisualState for MouseOver. The Default styles for DataGrid can be found here.

In the style for DataGridRow you want to change this:

<Rectangle x:Name="BackgroundRectangle" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0" Fill="#FFBADDE9"/>

That Rectangle is opaque but is made visible on mouse over. Changing the fill will change the background color on mouse over.

0

精彩评论

暂无评论...
验证码 换一张
取 消