问题
I need to know whether the Storyboard
is begun or not. If it is begun, I need to stop, otherwise I no need to stop. Both begin and stop will be done in code behind.
Currently I've done this:
if (parameter != null && parameter is System.Windows.Media.Animation.Storyboard)
{
if (!(bool)value)
{
(parameter as System.Windows.Media.Animation.Storyboard).Begin();
return Visibility.Visible;
}
else
{
(parameter as System.Windows.Media.Animation.Storyboard).Stop();
return Visibility.Collapsed;
}
}
I have faced the binding error:
System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='7861304'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='7861304'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'
Can anyone share how to stop the storyboard once its begun?
来源:https://stackoverflow.com/questions/32731701/how-to-check-the-storyboard-whether-this-is-begin-or-not