日期:2014-05-17  浏览次数:21003 次

WPF的ListBox排序问题
ListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("Order", System.ComponentModel.ListSortDirection.Ascending));

根据项的Order属性排序
第一次加入Item的时候,排序是正常的
但是当列表项加载完毕后,再更改这些项的Order属性,ListBox并不会重新排序
使用了ListBox.Items.Refresh()也不行
怎么解决?

------解决方案--------------------
ListBox.Items.SortDescriptions.Clear()
ListBox.Items.SortDescriptions.Add(...)