Sorting listbox in wpf
ListCollectionView can be used to sort listbox in wpf.
Create ListCollectionView instance providing the list collection.
var view = new ListCollectionView((IList)data); listbox.DataContext = view;
In the button click event you can add instance of SortDescription to which column and direction you wish to sort the view. Since listbox is bound to the ListCollectionView , sorting ListCollectionView also sorts the listbox.
view.SortDescriptions.Add(new SortDescription() { PropertyName = columnName, Direction = ListSortDirection.Ascending });






