Datagrid悬停不使用备用行颜色-wpf
这在DataGridRow中运行得很好Datagrid悬停不使用备用行颜色-wpf,wpf,datagrid,wpf-controls,wpfdatagrid,Wpf,Datagrid,Wpf Controls,Wpfdatagrid,这在DataGridRow中运行得很好 <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Background" Value="{StaticResource RolloverBrush}" /> <Setter Property="Foreground" Value="#000" /> </Trigger> 但是当我添加
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource RolloverBrush}" />
<Setter Property="Foreground" Value="#000" />
</Trigger>
但是当我添加这些时,鼠标悬停的样式不起作用
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="{StaticResource LightRowBrush0}" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="{StaticResource LightRowBrush1}" />
</Trigger>
样式的顺序很重要 在其他触发器工作之前应用交替触发器
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="{StaticResource LightRowBrush0}" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="{StaticResource LightRowBrush1}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource RolloverBrush}" />
<Setter Property="Foreground" Value="#000" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" Value="{StaticResource SelectedBrush}" />
<Setter Property="Foreground" Value="#000" />
</Trigger>
</Style.Triggers>
但这起作用了,