We are using 11.1..
In our GUI, when the user refreshed data on the grid, we call
xamGrid.Columns.Clear
and then do something like this...
if (xamGrid.Columns[colName] == null)
{
textColumn = new TextColumn();
textColumn.Key = colName;
xamGrid.Columns.Add(textColumn);
}
We get an "Object reference not set to an instance of an object" at the line xamGrid.Columns.Add ..
The stack trace shows this
at Infragistics.Controls.Grids.XamGridRowsManager.InvalidateGroupBy(Boolean reset).
How do I get rid of this error? I verified that the column count was zero after the call to the Columns.Clear
Hi,
I tried the code you posted in a button click, and it worked just fine:
this.grid1.Columns.Clear(); if (grid1.Columns["Number"] == null) { TextColumn tc = new TextColumn(); tc.Key = "Number"; this.grid1.Columns.Add(tc); }
What do you mean by referesh data...are you calling a method on the xamGrid or applying a new itemsSource?
Where are you adding the new columns? By that, i mean are you calling int while the xamGrid is performing an operation?
If you have a sample that shows this issue, it'd be much more helpful, and would allow me to figure out the problem a lot quicker.
Thanks,
-SteveZ
I am having the same issue. It happens only when grid is not part of visual tree (for example you try to add columns and you have different view navigated). I will create bug request for this.