如何在 StackPanel 中以动画方式插入/删除项目
我想要动画插入\删除 StackPanel 中的项目。
例如:如果新项目插入到集合中,所有其他项目都会顺利地为新项目释放空间,反之亦然。
谁能提出关于这个主题的例子或想法?
I want to animate insert\delete the item in a StackPanel.
Eg: If new item inserted into collection all other items smoothly free space for new item and vice versa.
Can anyone suggest examples or ideas on this topic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将对对象的
Height
进行动画处理如果添加,我将添加高度为 0 的项目并将其设置为全尺寸动画
如果删除,我会将高度设置为 0 进行动画处理,并在高度达到 0 时删除该项目
这应该适用于大多数单行项目,但如果您的项目包含多个旨在拉伸和适应可用空间的控件,则您可能必须找到其他解决方案。
I would animate the
Height
of objectsIf adding, I would add items with a Height of 0 and animate it full size
If deleting, I would animate the height to 0 and remove the item when the height hits 0
This should work for most single-line items, although if your items contain multiple controls that are designed to stretch and fit whatever space is available to them, you might have to find another solution.