How to set same animation to dynamically created images in winRT?

血红的双手。 提交于 2019-12-11 05:13:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!