我这里有一些按钮,它们位于一个wpf的堆叠面板内,按钮有一些略微弯曲的角落。我希望有一个动画,如果鼠标悬停在按钮上,它们会将按钮变成圆圈。但是这里的代码抛出" System.InvalidOperationException,这个Freezable不能被冻结。"
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Button.MouseEnter">
<BeginStoryboard>
<Storyboard Name="CurveStoryboard" Storyboard.TargetProperty ="Button" >
<ObjectAnimationUsingKeyFrames>
<DiscreteObjectKeyFrame KeyTime="0:0:5">
<DiscreteObjectKeyFrame.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border CornerRadius="30,30,30,30" ></Border>
</ControlTemplate>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</StackPanel.Triggers>
非常感谢。