如何在 StackPanel 中以动画方式插入/删除项目

发布于 2024-12-22 01:34:23 字数 105 浏览 2 评论 0原文

我想要动画插入\删除 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星星的軌跡 2024-12-29 01:34:24

我将对对象的 Height 进行动画处理

如果添加,我将添加高度为 0 的项目并将其设置为全尺寸动画

如果删除,我会将高度设置为 0 进行动画处理,并在高度达到 0 时删除该项目

这应该适用于大多数单行项目,但如果您的项目包含多个旨在拉伸和适应可用空间的控件,则您可能必须找到其他解决方案。

I would animate the Height of objects

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文