Hi James,
You can handle the VisibleColumn.Changing event and set the ExpressionDescriptor.Express property to your required expression. Here is a code snippet to show this.
private void VisibleColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == Syncfusion.Collections.ListPropertyChangedType.Add)
{
ExpressionFieldDescriptor ed = this.gridGroupingControl1.TableDescriptor.ExpressionFields["ExpressionColumn"];
GridVisibleColumnDescriptor column = e.Item as GridVisibleColumnDescriptor;
if( ed.Expression.IndexOf(column.Name) == -1)
{
string sOldValue = string.Format("+ [{0}]",column.Name);
ed.Expression += sOldValue;
}
}
else if( e.Action == Syncfusion.Collections.ListPropertyChangedType.Remove)
{
ExpressionFieldDescriptor ed = this.gridGroupingControl1.TableDescriptor.ExpressionFields["ExpressionColumn"];
GridVisibleColumnDescriptor column = e.Item as GridVisibleColumnDescriptor;
if( ed.Expression.IndexOf(column.Name) != -1)
{
string sOldValue = string.Format("+ [{0}]",column.Name);
string Expression = ed.Expression.Replace(sOldValue,string.Empty);
if( Expression.Equals(ed.Expression) )
{
Expression = ed.Expression.Replace(string.Format("[{0}] +",column.Name),string.Empty);
}
ed.Expression = Expression;
}
}
}
Here is a sample.
GGCExpressionField.zipBest Regards,
Haneef