You can add SortDescriptions to a WPF ListBox items to sort them in ascending or descending orders.
The following code snippet sorts a ListBox contents. You can write this code on a button click or any other event where you would like to sort your ListBox items.
listBox1.Items.SortDescriptions.Add(
new
System.ComponentModel.SortDescription("Content",
System.ComponentModel.ListSortDirection.Ascending ));