如何在winRT中为动态创建的图像设置相同的动画?

编程入门 行业动态 更新时间:2024-10-27 02:29:20
本文介绍了如何在winRT中为动态创建的图像设置相同的动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一组在 for 循环中动态生成的图像.我的目标是为所有这些相同的图像添加相同的故事板动画.我创建了动画,但是在 for 循环中应用它时,它只能一个接一个地应用因为之前必须停止根动画.我怎样才能做到这一点?

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?

提前致谢

推荐答案

您只能对单个目标使用动画,因此您需要复制动画以将其应用于多个目标.一种选择是每次都在后面的代码中创建故事板.另一种方法是将故事板放在一个 DataTemplate 中,并为每个 Image 单独加载它.然后,您还可以将 Image 控件和 Storyboard 放在 UserControl 中,并将该 UserControl 用于每个图像(通过 DataTemplate 或任何其他方式).

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).

这篇关于如何在winRT中为动态创建的图像设置相同的动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:37:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117769.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中为   图像   动画   动态   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!