0

如何在运行时为 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”的值,因为有关包含类的信息不可用。

4

1 回答 1

0

好吧,这个怎么样...

Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty));
Storyboard.SetTarget(keyFrameDa, cardBack.Projection);
于 2012-10-02T16:18:56.260 回答