Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Present ListBox Items Bottom-to-Top

I've searched for quite a while trying to find an answer to this without any results.

The default WPF Listbox adds items aligned at the top, and additional items below it. I'd like a listbox which presents the items in the opposite direction, so it adds items aligned to the bottom.

Example: enter image description here

I'm sure there must be a simpler way that I've overlooked to do this without rewriting it all, but Google doesn't seem to have the answer for this one and I'm stumped.

Thanks.

like image 680
K893824 Avatar asked Feb 05 '12 21:02

K893824


1 Answers

Change the ItemsPanel's layout:

<ListBox.ItemsPanel>
    <ItemsPanelTemplate>
        <VirtualizingStackPanel VerticalAlignment="Bottom"/>
    </ItemsPanelTemplate>
</ListBox.ItemsPanel>

This does what your image seems to imply, with the first item added still on top. If you want to reverse the order as well that would be a different issue.

like image 169
H.B. Avatar answered Sep 28 '22 02:09

H.B.