0
votes

I have a WPF Listbox defined in a DataTemplate that has its ItemsSource bound to an ObservableCollection. When new items are added to the collection, I want the ListBox to work in "insert mode", always adding to the front of the list, not the default append mode. How do I make the ListBox use the insert mode when not adding to it directly in code?

1

1 Answers

1
votes

Use the Insert method of the ObservableCollection and pass the index 0 - that will add it to the beginning of the collection.