本文介绍了单击DataGridView列标题时禁用排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 DataGridView 列标题.当我单击该标题时,将根据该值重新计算数据.
I have a DataGridView column header. When I click that header, the data is resorted according to the value.
我不要.
DataGrid 具有 AllowSort 属性.DataGridView没有.我能做什么?
DataGrid has an AllowSort property. DataGridView doesn't have that. Anything I can do?
推荐答案您可以覆盖OnColumnAdded函数:
You can override OnColumnAdded function:
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { base.OnColumnAdded(e); e.Column.SortMode = DataGridViewColumnSortMode.NotSortable; }更多推荐
单击DataGridView列标题时禁用排序
发布评论