【发布时间】:2013-10-07 16:30:07
【问题描述】:
我想使用 ProgressBar 可视化一个冷却计时器,我想通过使用 StoryBoard 来解决它,并且每次我的 DataContext 刷新它都应该触发一个动画(冷却)。
我想知道是否有一种方法可以将属性绑定到动画的Int32 值上。
Duration 属性表示一个 DateTime 值。我需要将整数值绑定为持续时间的秒数。有没有办法不将 Int 转换为 DateTime?如果有任何其他关于实现冷却的建议,我很高兴听到它!
<DoubleAnimation Storyboard.TargetName="timeToUpdateBar" Storyboard.TargetProperty="Value" From="100" To="0" Duration="{Binding myDataContext.myIntValueInSeconds}" RepeatBehavior="1x"/>
感谢期待
【问题讨论】:
-
使用适当的binding converter。