I think I found a bug regarding the DataGridViewRow.Selected property. It appears that changing the grid DataSource and immediately setting the Selected property of a row has no effect (at least within the CellClicked event). It seems to always select the first row of the grid.
I’ve attached a project showing the issue.
we have checked in more detail and found that in fact it´s not a bug.
When changing the data source the focus cell is reset which causes the selection to be cleared. Works the same in WinForms. In fact in WinForms it’s impossible to change the selected rows right after changing the data source.
With Wisej it is possible thanks to its asynchronous nature. Change the sample code to:
// Restore selection.
foreach (DataGridViewRow row inthis.dataGridView1.Rows)
row.Selected = true;
row.Selected = false;
BeginInvoke() in Wisej is executed within the same request and on the same thread but *after* the entire request has been completed. It’s basically a post-process callback. It allows an application to execute code asynchronously. Which is different from Application.StartTask().
Hope that helps.
Please login first to submit.