C#的DataGridView不排序复选框列 [英] C# Datagridview does not sort Checkbox column

查看:134
本文介绍了C#的DataGridView不排序复选框列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我一个LINQ到SQL查询绑定到一个DataGridView(使用之间的BindingSource),列默认排序。不过,这似乎并不为布尔类型的情况。对于这些DataGridView的使用复选框列,但是当我点击标题没有任何反应。解决方案的人?

When I bind a Linq-to-sql query to a datagridview (using a BindingSource in between), the columns are sortable by default. However, this does not seem to be the case for boolean types. For these the datagridview uses Checkbox columns, but when I click on the header nothing happens. Solution anyone?

推荐答案

在VS2012中,你还可以设置SortMode设计师。

In VS2012 in the designer you can also set the SortMode.

这是在DataGridView右键点击并进入编辑列。

Right-click on the DataGridView and go to "Edit Columns".

有一个下拉的SortMode与NotSortable,自动,编程的选择。

There's a drop-down for SortMode with a choice of NotSortable, Automatic, and Programmatic.

看来,对于大多数列默认为自动,但对于复选框(布尔)列默认为NotSortable。

It appears that the default for most columns is Automatic, but for checkboxes (boolean) columns the default is NotSortable.

这篇关于C#的DataGridView不排序复选框列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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