AD
Administrator
Syncfusion Team
June 14, 2006 11:58 PM UTC
The column descriptor collection is immutable meaning that when it is changes, a new insance of it needs to be created with the change. So, the old descriptor that you cached in a local variable was nulled out when the new collection was created as the result of modifying the expression. But if you access the descriptor directly from the collection, and not through a local variable, you will get the new instantiated descriptor for that column. So, this code shows none-null values in both places.
GridColumnDescriptor colDesc = gridGroupingControl1.TableDescriptor.Columns["Col0"];
if(colDesc.FieldDescriptor != null)
Console.WriteLine("not null A");
this.gridGroupingControl1.TableDescriptor.ExpressionFields["Expression"].Expression = "=[Col2]";
colDesc = gridGroupingControl1.TableDescriptor.Columns["Col0"];
if(colDesc.FieldDescriptor != null)
Console.WriteLine("not null B");