问题
I have a set of images which are generated dynamically in a for loop.My objective is to add same storyboard animation to all these same images.I created the animation but while applying it in for loop it can apply only one after another because root animation must stop before.How can I achieve this?
Thanks in advance
回答1:
You can only use an animation with a single target so you need to duplicate the animation to apply it to multiple targets. One option is to create the storyboard in code behind each time. Another is to put the storyboard in a DataTemplate and load it separately for each Image. Then you can also put the Image control and the Storyboard in a UserControl and use that UserControl for each image (via DataTemplate or any other way).
来源:https://stackoverflow.com/questions/14392720/how-to-set-same-animation-to-dynamically-created-images-in-winrt