可能重复:
How can I implement fading in and out of Added/Removed ListItems
当我删除项目时,我尝试LayoutStates
和FrameworkElement.Unloaded
来制作动画,但它不起作用。
我认为在执行动画之前删除了该项目!
有人知道解决方案吗?
<EventTrigger RoutedEvent="FrameworkElement.Unloaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.6"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1.6"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.6"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1.6"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>