Reputation: 125
I'm trying to add some child elements of StackPanel on top.
There is a code:
<StackPanel Orientation="Vertical">
<Border Background="SkyBlue">
<TextBlock>Stacked Item #1</TextBlock>
</Border>
<Border Background="CadetBlue">
<TextBlock>Stacked Item #2</TextBlock>
</Border>
<Border Background="LightGoldenRodYellow">
<TextBlock >Stacked Item #3</TextBlock>
</Border>
and there is a image:
I want the child elements to be added up instead of down, how can I do this?
Like this:
Stacked Item 3
Stacked Item 2
Stacked Item 1
Upvotes: 1
Views: 1479
Reputation: 125
I found the solution.
StackPanel.Children.Insert(0, UIElement)
This will insert child element at the head of the list.
Upvotes: 2