Problem with multi columns order symbol in DatagridView

0
1

Hi, I am using DatagridView control and would like to implement multicolumn sorting.
The operation has been successfully implemented only I can’t display the sort symbol for multiple columns at once.

It seems to me that in a past version it worked, currently I set the
column.HeaderCell.SortGlyphDirection of the affected columns,
but it seems that the table only makes the last one in the list visible.

In the Browser, however, they are all present and by updating the “display” property it appears.

Is there any way to solve the problem and allow me to display the symbol simultaneously on multiple columns?

Best regards

  • You must to post comments
0
0

Hi Tiziana,

SortGlyphDirection can only be visible on one column, that’s how it’s designed.
If you need more than one image in a header cell you can also implement it with a UserControl or a Panel,
remembering you can put any control inside a header cell:

headercell

 

 

 

Of course you need to handle all the icons etc. in your code.

Best regards
Frank

  • You must to post comments
0
0

Hi Frank, I’ve implemented the SortComparer and it works.

My issue lies specifically in displaying the sorting symbol in the DataGridView control. For each column, there’s a property called column.HeaderCell.SortGlyphDirection which should show the sorting symbol correctly.

The problem is that I can only assign one symbol at a time because when I assign it to a second column, the symbol for the first one disappears.

I thought about using the control’s image field, but in some cases, I’m already using it for other purposes.

Is there a possibility, perhaps with an option on the control, to prevent the sorting symbol of one column from disappearing if I assign it to another? I’ll handle it programmatically if needed.

Best Regards

Tiziano

  • You must to post comments
0
0

Hi Tiziano,

while you can sort by multiple columns with implementing your SortComparer,
you will have to show custom images in the header cells reflecting the sort status.
A visual display of multi column sorting is not supported out of the box.

Best regards
Frank

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.