Rhys Towey Rhys Towey - 1 year ago 234
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?

Answer Source


stackPanel.Children.Insert(0, uiElement);

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download