最主要的是在ItemContainerStyle中设置EventTrigger。
使用其他具有items的控件时也是可以通用类似的代码
截图
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiYWan5iN2MTNxkTM2gTMtATO1UjM2QTMxEzMyETOxAjMtEDOxAzM48CXyETOxAjMvwVM4EDMzgzLcd2bsJ2Lc12bj5ycn9Gbi52YugTMwIzZtl2Lc9CX6MHc0RHaiojIsJye.gif)
<Grid>
<ListBox x:Name="c" >
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<EventTrigger RoutedEvent="Selected">
<BeginStoryboard>
<Storyboard Storyboard.TargetProperty="IsSelected">
<BooleanAnimationUsingKeyFrames>
<DiscreteBooleanKeyFrame KeyTime="0:0:0:0.1">
<DiscreteBooleanKeyFrame.Value>
<num:Boolean>False</num:Boolean>
</DiscreteBooleanKeyFrame.Value>
</DiscreteBooleanKeyFrame>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBoxItem Content="AAAA" />
<ListBoxItem Content="BAAA" />
<ListBoxItem Content="ACAAA"/>
<ListBoxItem Content="ADAA" />
<ListBoxItem Content="AEAA"/>
</ListBox>
</Grid>