Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
758 views
in Technique[技术] by (71.8m points)

c# - System.Windows.Media.Animation Warning: 6

When I run animation in wpf using storyboard I am getting following error in output window.

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='57850459'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='57850459'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'

Can anyone tell me how it will affect my program and how to remove it?

I haven't define storyboard in .xaml file. But when code behind design file(.xaml) I have created private stoaryboard in class and i am assigning it to framework element using following syntax in code.

this.storyboard1.Begin(this.viewbox1, true);

where storyboard1 is object that I have created in class and viewbox1 is element to which I want to apply this animation.

Can anybody help me? Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I too had this warning, but found that the 'containingElement' specified in the Begin call must also be specified in the Stop call, which should eliminate the warning.

this.storyboard1.Begin(this.viewbox1, true);

this.storyboard1.Stop(this.viewbox1);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...