System.Windows.Media.Animation Warning: 6

2020-02-14 20:17发布

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.

1条回答
男人必须洒脱
2楼-- · 2020-02-14 20:32

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);
查看更多
登录 后发表回答