Rhys Towey Rhys Towey - 6 months ago 100
C# Question

StackPanel reverse order - WPF

I am trying to reverse the order of which the children appear in the StackPanel. I want to be able to add new children (whilst running the app) to the top of the list instead of the bottom. I have tried using various XAML code but nothing worked.

What is the easiest way to do this?



stackPanel.Children.Insert(0, uiElement);

This will insert the element at the head of the list.