In my application I am adding items to a ListBox
in C#. I am adding the collection of items which are held in a StackPanel
using the code:
ListBoxControl.Items.Add(stackPanel);
But this adds the StackPanel
to the bottom of the ListBox
, is there any way of adding the StackPanel
to the top rather than the bottom?
(It is not possible to add the items to the ListBox
in reverse order.)
You can just use the Insert method as Matthew mentioned before or just using Reverse().
ListBoxControl.Items.Add(stackPanel);
ListBoxControl.Items.Reverse();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.