我有一个
ListView
ItemContainerStyle
定义如下:
<ListView Width="auto"
SelectionMode="Single"
ItemContainerStyle="{StaticResource ItemContStyle}"
....
baseListViewStyle
,我定义了一些基本样式以应用于我的
列表视图
Style
触发:
<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>
这个
Trigger
当鼠标移到行上时,此处高亮显示该行。不错。
我也有一个
DataTrigger
上
ListViewItem
:
<Style.Triggers>
<DataTrigger Binding="{Binding IsTestTrue}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource SomeFunkyAnimation}" />
</DataTrigger.EnterActions>
</DataTrigger>
如果测试是真的,那么一个很好的小淡入淡出动画播放出来。这一切工作,除了当我把我的鼠标移到行“测试是真的”动画停止和鼠标样式显示。
你知道我怎样才能在我的生活中超越这种风格吗
数据触发器
?
短暂性脑缺血发作
更新:
SomeFunkyAnimation
设置背景颜色的动画。它的xaml如下:
<Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource baseListViewStyle}">
<Style.Resources>
<Storyboard x:Key="SomeFunkyAnimation" FillBehavior="Stop">
<ColorAnimation Storyboard.TargetProperty="Background.Color" RepeatBehavior="Forever" From="Red" To="Pink" Duration="0:0:3"/>
</Storyboard>
</Style.Resources>
这个
MouseOver
baseListViewStyle
. 这个
数据触发器
ItemContStyle
我试着把它取下来
鼠标悬停
但我相信这并没有起作用
Listview
鼠标悬停
样式已定义,因此它将覆盖我的
数据触发器
动画。