简体   繁体   English

按行标题C#对datagridview进行排序

[英]Sort datagridview by row header C#

I have a datagridview like this one: 我有一个像这样的datagridview:

         | foo | bar | baz | ...
------------------------------------------
Name 1   | asd | dsa | sad | ...
Name 2   | ...
Name 3   | ...
...      | ...

Name X is in RowHeaderCell and I want to sort this datagridview by name, how can I do that? 名称X在RowHeaderCell中,我想按名称对这个datagridview进行排序,我该怎么做? datagridveiw.Sort() wors only for columns and not row headers... datagridveiw.Sort()仅适用于列而不适用于行标题...

thanks! 谢谢!

J. J.

There is no built-in way to do this. 没有内置的方法可以做到这一点。 You would need to respond to the row header clicked event and in that event handler implement the code you need to sort. 您将需要响应行标题单击事件,然后在该事件处理程序中实现您需要排序的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM