在C#winforms中使用绑定列表时,如何在datagridview列标题中应用排序 [英] How to apply sort in datagridview columns header when using binding list in C# winforms

查看:174
本文介绍了在C#winforms中使用绑定列表时,如何在datagridview列标题中应用排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#winforms中使用绑定列表时在datagridview列标题中应用sort



网格列是在Winforms.auto中动态创建的排序不适用于绑定列表。

解决方案

这个代码项目文章可能会帮助您入门,

非常非常快速地实现Sortable BindingList [ ^ ]


Hi
列表的datagridview排序可以通过



1)将List对象转换为 IBinding 接口 IBinding界面 [ ^ ]



2)通过在 datagridview

中使用 ColumnHeaderMouseClick 事件,请参阅这些

使用通用列表作为DataSource对DataGridView进行排序 [ ^ ]

在用户点击列标题时启用DataGridView排序 [ ^ ]



3)Con将列表转换为数据表

将列表转换为数据表 [ ^ ]

List to Datatabe [ ^ ]

将列表转换为DataTable [ ^ ]

how to apply sort in datagridview columns header when using binding list in c# winforms

Grid columns are created dynamically in Winforms.auto sort is not work for binding list.

解决方案

this codeproject article might be helps you to get started,
Implementing a Sortable BindingList Very, Very Quickly[^]


Hi The datagridview sorting for a list could be achieved by

1) converting the List object to an IBinding interface IBinding interface[^]

2) By using the ColumnHeaderMouseClick event in the datagridview
refer these
Sorting a DataGridView with a Generic List as DataSource [^]
enable DataGridView sorting when user clicks on the column header [^]

3) Converting your List to a datatable
convert a list into data table [^]
List to Datatabe[^]
Convert List to DataTable [^]


这篇关于在C#winforms中使用绑定列表时,如何在datagridview列标题中应用排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆