WPF Trigger / Style overrides another
- by ozczecho
I have a listview defined as such
<ListView Width="auto"
SelectionMode="Single"
ItemContainerStyle="{StaticResource baseListViewStyle}"
....
Then in "baseListViewStyle" I have defined some base styles to apply to my list views, including a Style trigger:
<Style x:Key="baseListViewStyle" TargetType="ListViewItem">
<Setter Property="Height" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
The trigger here highlights the row when mouse is over it. Nice.
I also have a Data Trigger on the listviewitem:
<Style.Triggers>
<DataTrigger Binding="{Binding IsTestTrue}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource SomeFunkyAnimation}" />
</DataTrigger.EnterActions>
</DataTrigger>
If test is true then a nice little fade animation is played out. This all works except when I move my mouse over the row where "test is true" the animation stops and the mouse over style is displayed.
Any ideas how I can override that style in my DataTrigger?
TIA