在wpf中更改stackpanel的子索引

时间:2012-05-07 20:34:41

标签: c# wpf controls stackpanel

我想知道如何在 c#c​​ode 中更改StackPanel的子索引

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

我正在使用StackPanel,因为我需要Orientation属性来堆叠所有元素并将它们组合在一起。如果您最好使用其他控件,我会对此持开放态度。

1 个答案:

答案 0 :(得分:6)

StackPanel.Children是一个UIElementCollection,可以轻松地通过以下方式重新排序元素其InsertRemoveAt方法。