I am using a Datagridview were I have a 2 layouts. The user has buttons to toggle between them. This works fine using the following code to change the column porperties:
private void SetColumnOrder()
{
List items = m_WorkSheet.LoadColumnSettings(m_SessionState);
DataGridViewColumnCollection columns = c_DataGridView.Columns;
int sensorId = 0;
for (int colInx = 0 ; colInx < columns.Count ; colInx++)
{
for (int i = 0 ; i < items.Count ; i++)
{
sensorId = ((WDSSDataObject)((ColumnTagItem)columns[colInx].Tag).DataSource).DB_ID;
if (items[i].SensorId == sensorId)
{
columns[colInx].Width = items[i].Width;
columns[colInx].DisplayIndex = items[i].DisplayIndex;
columns[colInx].Visible = items[i].Visible;
ColumnTagItem a = (ColumnTagItem)columns[colInx].Tag;
columns[colInx].Tag = new ColumnTagItem { DataSource = a.DataSource };
columns[colInx].Update();
c_DataGridView.Update(); // did not help but I tried it
break;
}
}
}
}
However if the user manipulates a column A in DGV ie resizes the column and then toggle between layouts then column A does not change back to the width specified by the layout, this is also true for show/hide and move.
The only thing I have not tried was to drop the columns from DGV and rebuild them.
Any thoughts
Alex
Hi Luca,
Any update on this issue, I am using version 1.4.50.0
Alex Berze
We have a lot of fixes coming up also related to the DGV. I’ll add this test case to the tests to make sure it’s fixed as well. The calls to Update() are not (should not be) necessary.
Please login first to submit.