在wpf中更改stackpanel的子级索引 [英] change the children index of stackpanel in wpf

查看:73
本文介绍了在wpf中更改stackpanel的子级索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用 c#代码来更改StackPanel的儿童索引.

I want to know how I can change the children index of a StackPanel in c# code.

例如,我想让当前第二个孩子首先显示.更改索引时需要动画.

For example, I want to make the child that is currently second to be displayed first. I need animation when changing the index.

我正在使用StackPanel,因为我需要Orientation属性来堆叠所有元素并将它们分组在一起.如果您有更好的主意使用其他控件,则可以接受.

I am using a StackPanel because I need the Orientation property to stack all elements and keep them grouped together. If you have better idea to use another control, I am open to that.

推荐答案

StackPanel.Children 插入 RemoveAt 方法.

StackPanel.Children is a UIElementCollection that easily allows to reorder elements by e.g. its Insert and RemoveAt methods.

这篇关于在wpf中更改stackpanel的子级索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆