How to sort in a WPF ListBox?
The C# 4.0 WPF application, see the code below, shows on startup: abd after clicking the Sort button with btnSort_Click() click event handler: How can I sort in order aaa, bbb, ccc? C# code: public MainWindow() { InitializeComponent(); listBox1.Items.Add("ccc"); listBox1.Items.Add("aaa"); listBox1.Items.Add("bbb"); } private void btnSort_Click(object sender, RoutedEventArgs e) { listBox1.Items.SortDescriptions.Add( new System.ComponentModel.SortDescription("Content", System.ComponentModel.ListSortDirection.Ascending)); } private void listBox1_MouseDoubleClick(object sender,