In Silverlight Grid, Disable row color change on mouse hover on row?
How to disable color change (to gray) when mouse hover on a row of grid? How to disable color change (to gray) when row is selected by mouse click or keyboard/Enter combination?
I want to keep the originally assigned row color.
Please adv开发者_开发技巧ice.Thanks AJ
You will need to specify a new template for the DataGridRow
via a style on the the RowStyle
property. Use the existing style for DataGridRow
found here.
Remove the StoryBoard
elements for the "MouseOver", "NormalSelected" and "MouseOverSelected" VisualStates also remove the DoubleAnimation
for "BackgroundRectangle" from the "UnfocusedSelected" VisualState.
I had a similar requirement, but instead turned off HitTest so the user couldn't select a row.
It occurred to me that if you don't want the user to know what the selection is, then you don't want a selection.
<Style TargetType="data:DataGridRow" x:Key="StyleDataGridRowNoSelection" BasedOn="{StaticResource BaseDataGridRowStyle}">
<Setter Property="IsHitTestVisible" Value="False"/>
</Style>
精彩评论