[英]Control stops working after animating it
I have a slider named tbMaster
: 我有一个名为tbMaster
的滑块:
<Slider Name="tbMaster" Maximum="10000" Value="{Binding SbVolumeValue}"/>
code behind for binded property: 绑定属性后面的代码:
double _SbVolumeValue;
public double SbVolumeValue
{
get
{
return _SbVolumeValue;
}
set
{
_SbVolumeValue = value;
OnPropertyChanged("SbVolumeValue");
}
}
I have the storyboard sbVolume
我有情节sbVolume
<Storyboard x:Key="sbVolume">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RangeBase.Value)" Storyboard.TargetName="tbMaster">
<EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="40">
<EasingDoubleKeyFrame.EasingFunction>
<CircleEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
if I run the application the slider works great. 如果我运行该应用程序,则滑块会很好用。 It stops working when I begin the storyboard as: 当我启动情节提要时,它停止工作:
var sbVolume = this.FindResource("sbVolume") as Storyboard;
sbVolume.Begin();
why does it stops working after I animate it? 为什么在设置动画后它停止工作?
Try adding a FillBehavior.Stop
to your Animation. 尝试将FillBehavior.Stop
添加到动画中。 The default is FillBehavior.HoldEnd
. 默认值为FillBehavior.HoldEnd
。
From Above Link: 从上方链接:
Because an animation in its fill period continues to override its target property's value, attempting to set the target property's value through other means might appear to have no effect. 由于动画在其填充期中继续覆盖其目标属性的值,因此尝试通过其他方式设置目标属性的值似乎无效。 For an example showing how to set a property value after it has been animated, see How to: Set a Property After Animating It with a Storyboard. 有关显示属性值动画后如何设置属性的示例,请参见如何:使用情节提要对其进行动画处理后设置属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.