如何在运行时为DoubleAnimationUsingKeyFrames设置TargetName?
<Storyboard x:Name="sr">
<DoubleAnimationUsingKeyFrames x:Name="keyFrameDA" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="cardBack">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
我试过了
Storyboard.SetTargetName(keyFrameDA, "cardBack");
但是DoubleAnimationUsingKeyFrames没有这样的属性。感谢。
更新: 当我使用这段代码时,这个错误就会抛出:
Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty));
Storyboard.SetTarget(keyFrameDa, cardBack.Projection);
错误:KeyFramesProperty - 无法获取字段'KeyFramesProperty'的值,因为有关包含类的信息不可用。
答案 0 :(得分:0)
好的,这个怎么样......
Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty));
Storyboard.SetTarget(keyFrameDa, cardBack.Projection);