问题
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.
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.
回答1:
StackPanel.Children is a UIElementCollection that easily allows to reorder elements by e.g. its Insert and RemoveAt methods.
来源:https://stackoverflow.com/questions/10488738/change-the-children-index-of-stackpanel-in-wpf