首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

WPF的ListBox排序有关问题

2013-02-19 
WPF的ListBox排序问题ListBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription(O

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(...)

热点排行