当 Button 或 ContentControl 等内容控件更改其内容时,我试图触发动画。我最初的想法是这样做:
<ContentControl x:Name="ContentElement">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<ContentPresenter x:Name="Content">
<ContentPresenter.Triggers>
<EventTrigger RoutedEvent="WHATGOESHERE">
<BeginStoryboard Storyboard="{StaticResource MyAnimation}" Storyboard.TargetName="Content"/>
</EventTrigger>
</ContentPresenter.Triggers>
</ContentPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Style>
<Button Content="Hello"/>
</ContentControl>
但是我不知道 ContentPresenter 更改/更新时会触发哪个事件。有任何想法吗?