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 Tiziano,

currently there are just 2 options for you. Either exclude the column from being shown in the Column Visibility Menu or set the column’s HeaderText property.

Best regards
Frank

  • You must to post comments
0
0

Hi Frank,

Thanks to your suggestion, I was able to implement my custom headers by using a super control that contains a label and the image I need. Everything works as I want. There’s just one issue left: the menu that allows you to Show/Hide the columns only shows the checkboxes but not the column names. Is there a way to display it? I tried exposing the “HeaderText” property from the UserControl, but it doesn’t work.

Best regards

Tiziano

  • 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 5 results
Your Answer

Please first to submit.