DataGridViewColumn初始排序方向 [英] DataGridViewColumn initial sort direction
本文介绍了DataGridViewColumn初始排序方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图扭转这一点,所以初始点击排序降序,然后第二次点击排序升序,我无法弄清楚如何做到这一点。有人知道吗?
谢谢
解决方案
您可以设置HeaderCell将SortGlyphDirection转到Ascending,然后点击下一步就会降序。默认值为none。
dataGridView1.Sort(Column1,ListSortDirection.Ascending);
this.Column1.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.Ascending;
I'm working in VS2008 on a C# WinForms app. By default when clicking on a column header in a DataGridView it sorts that column Ascending, you can then click on the column header again to sort it Descending.
I am trying to reverse this, so the initial click sorts Descending then the second click sorts Ascending and I haven't been able to figure out how to do this. Does anyone know?
Thanks
解决方案
You can set the HeaderCell SortGlyphDirection to Ascending, and then the next click will give you the descending order. The default is none.
dataGridView1.Sort(Column1, ListSortDirection.Ascending);
this.Column1.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.Ascending;
这篇关于DataGridViewColumn初始排序方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文