在BindingList中使用排序 [英] Use Sorting in BindingList
本文介绍了在BindingList中使用排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将BindingList< items> lstItems绑定到数据网格。如何为任何列实现sort选项。
I have "BindingList<items> lstItems" bounded to a datagrid. How can I implement the sort option for any column.
推荐答案
在Web上有多个SortableBindingList解决方案,它们来自BindingList。
[甚至微软也有一个。]
绑定时,你可以在DataGridView中获得可排序的列
There are multiple solutions of a SortableBindingList, derived from BindingList, on the web.
[Even Microsoft has one.]
When binding this, you get sortable columns in your DataGridView
你可以使用List的Sort方法,如下所示:
列表< object> list = myBindingList.ToList();
list.Sort();
myBindingList = new BindingList< object>(list);
很容易和快速。
You can use the Sort method of the List, like this:
List<object> list = myBindingList.ToList();
list.Sort();
myBindingList = new BindingList<object>(list);
Its easy and seens to be fast.
这篇关于在BindingList中使用排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文