DataGridView in Virtual mode can't sort

0
0

Hi everyone,
I have a DataGridView which passed from being a normal GridView with a DataSource bound to it to a GridView with virtual mode.

Previously when firing the event ColumnHeaderMouseClick i was able to get which column was sorted on and how the sort would be applied by using the following code
private DataGridViewColumn _sortColumn;
public SortOrder SortOrder { get; set; }

private void DataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
_sortColumn = dataGridView1.SortedColumn

if (_sortColumn != null)
{
SortOrder = dataGridView1.SortOrder;

if (dataGridView1.Rows.Count > 0)
{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows[0].Index].Cells[_sortColumn.Index];
}
}
}

The code hasn’t changed but i changed to GridView to Virtual Mode and when firing the same event the _sortedColumn equals null and the SortMode is set to None, even if the Glyph appears.

I’m doing something wrong or is it a bug?

Is there a possible way to know in virtual mode on which column to sort and in which direction?

In the attachment I’ve uploaded a sample project.

Best of regards, Alex.

  • You must to post comments
0
0

Hi Frank,

i have reuploaded the project.

I hope you have a good day,

Alex.

  • You must to post comments
0
0

Hi Alexandru,

there seem to be problems with your attachment.

Can you please try to readd it ?

Thanks in advance,
Frank

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.