【问题标题】:How to set parameters to a storyboard in wpf?如何在 wpf 中为情节提要设置参数?
【发布时间】:2011-01-11 02:43:02
【问题描述】:

假设我有这个故事板:

<Storyboard x:Key="OnMouseEnterStoryboard">
                    <DoubleAnimation BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" To="180" />
            </Storyboard>

有可能我可以从代码中设置To 属性。像

DoubleAnimation BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" To="{Binding angle}" />

当我想应用这个动画有可能设置它?

【问题讨论】:

    标签: wpf animation storyboard


    【解决方案1】:

    我完全同意@Paul 所说的:Storyboard 属性绑定与绑定属性的“正常”方式没有什么不同。

    无论如何,thisthisthisthisthis 是您应该关注的链接,如果您想要一些关于 Storyboard 和 Animation 的良好示例以及属性绑定。


    【讨论】:

      【解决方案2】:

      Storyboards 可以有绑定,就像其他任何东西一样 - 与其尝试挖掘并显式设置它,不如将其绑定到更容易获得的东西,例如 Window 对象或 ViewModel

      【讨论】:

      • 你能给我举个例子吗?我真的不明白你的想法。我是 WFP 的初学者
      猜你喜欢
      • 2010-12-11
      • 1970-01-01
      • 2021-05-24
      • 1970-01-01
      • 2011-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      相关资源
      最近更新 更多