在wpf中更改stackpanel的子索引

Mam*_*d R 4 c# wpf controls stackpanel

我想知道如何在c#代码中更改StackPanel 的子索引.

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

我正在使用StackPanel,因为我需要Orientation属性来堆叠所有元素并将它们组合在一起.如果你有更好的想法使用另一个控件,我对此持开放态度.

Cle*_*ens 6

StackPanel.Children是一个UIElementCollection,它可以轻松地通过例如InsertRemoveAt方法重新排序元素.