【问题标题】:Windows Phone - Storyboard TargetName in runtimeWindows Phone - 运行时中的 Storyboard TargetName
【发布时间】:2012-09-23 12:48:21
【问题描述】:

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

【问题讨论】:

    标签: c# windows-phone-7 xaml storyboard


    【解决方案1】:

    好吧,这个怎么样……

    Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty));
    Storyboard.SetTarget(keyFrameDa, cardBack.Projection);
    

    【讨论】:

    • 已编辑...抱歉,不在我可以进行试编译的机器上。
    • 谢谢。在我看来,它必须有效。但它在第一行给出“值不能为空。参数名称:元素”错误。
    • 我可以为您将解决方案上传到 SkyDrive 吗?如果你有时间? )) 因为有点急。
    • 确切的错误是:KeyFramesProperty = 无法获取字段“KeyFramesProperty”的值,因为有关包含类的信息不可用。
    • 很遗憾,我不在可以编译和协助的计算机旁。也许其他人可以加入并提供进一步帮助。
    猜你喜欢
    • 1970-01-01
    • 2013-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-23
    • 2015-10-22
    相关资源
    最近更新 更多