public static void RemoveDynamicBand(GridBand onThisBand, BandOptions bandOptions) { if (onThisBand == null) { throw new ArgumentException("ExistingBand required"); } if (onThisBand.View == null) { throw new ArgumentException("ExistingBand.View required"); } if (bandOptions.BandIdentifier == null) { throw new ArgumentException("BandIdentifier required"); } onThisBand.View.BeginDataUpdate(); GridBand bandToDelete = null; foreach (GridBand childBand in onThisBand.Children) { if (childBand.Tag != null) { var keyValue = childBand.Tag as string; if (keyValue == bandOptions.BandIdentifier.Key) { bandToDelete = childBand; break; } } } if (bandToDelete != null) { for (int i = bandToDelete.Columns.Count - 1; i >= 0; i--) { bandToDelete.Columns.RemoveAt(i); } onThisBand.Children.Remove(bandToDelete); } onThisBand.View.EndDataUpdate(); }
public GridOptions() { BandOptions = new BandOptions(); ColumnOptions = new ColumnOptions(); }