<Style TargetType="ListBoxItem">
<!-- 没有被选中就是有点模糊 -->
<Setter Property="Opacity" Value="0.5" />
<Setter Property="MaxHeight" Value="75" />
<Style.Triggers>
<!-- 触发器设置选中了就取消模糊变正常 -->
<Trigger Property="IsSelected" Value="True">
<Setter Property="Opacity" Value="1.0" />
</Trigger>
<!-- 鼠标进入 -->
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="MaxHeight"
To="90"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<!-- 鼠标离开 -->
<EventTrigger RoutedEvent="Mouse.MouseLeave">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="MaxHeight" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
本文转载自: https://blog.csdn.net/weixin_46407807/article/details/136635105
版权归原作者 励志35岁去越南躺平的造砖核动黑马程序猿 所有, 如有侵权,请联系我们删除。
版权归原作者 励志35岁去越南躺平的造砖核动黑马程序猿 所有, 如有侵权,请联系我们删除。