views:

60

answers:

1

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  A: 

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

Aviad P.