I have multiple (dynamically created) controls in a grid (labels, buttons), and one storyboard!
I can assign a storyboard to one control, but I want to apply the storyboard’s animation in each controls…how can I do this?
My code:
Storyboard myStoryboard1 = new Storyboard();
Label label1 = new Label();
Label label2 = new Label();
Label label3 = new Label();
...
Storyboard.SetTarget(myAnimation2, Label1);
Storyboard.SetTarget(myAnimation2, Label2);
Storyboard.SetTarget(myAnimation2, Label3);
This code is set the animation only to the Label3…
Thanks!
The best way to do this is by making one or multiple styles for all the control types that you want to animate and base them all on a single style that contains the storyboard/animation.
Then, after you create/add a control just set its style (or make the styles the default styles)