We have an issue with DataGridView’s Cell-Style getting not updated when set within a task using Application.StartTask.
In the attached demo we set some values of a DataGridView but column three is calculated in a task startet with Application.StartTask. Within this task we set the value of the cell and also call Application.Update. Depending on the result we want to apply formating using the CellFormating event. But the updated style is not displayed while the text is shown.
The style is properly updated when reloading the page with F5.
Hi Bernhard,
bug fix is included in Wisej dev build 1.4.59.
Best regards
Frank
I can confirm this as fixed
The problem is that the CellStyle in the formatting event is not the style of the cell, changing the properties of the e.CellStyle doesn’t change the cell.Style value, which is correct. But when the update of a few cell values doesn’t trigger a data request, the style change in the formatting event is not “captured” by the small pushed update.
It is a bug that I’ll log.
You can overcome it by either setting the style of the cell, or by using BeginUpdate() and EndUpdate() to let the DGV know that it should reload the data page, which includes also the style values changed in the formatting event:
Application.StartTask(() =>
{
System.Threading.Thread.Sleep(2500);
this.dataGridView1.BeginUpdate();
dataGridView1.Rows[0].Cells[2].Value = “c1”;
dataGridView1.Rows[1].Cells[2].Value = “c2”;
dataGridView1.Rows[2].Cells[2].Value = “c3”;
this.dataGridView1.EndUpdate();
Application.Update(this);
});
Please login first to submit.