void fg_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e) { // total on Sale Amount int totalOn = _flex.Cols["Sale Amount"].SafeIndex; string caption = "Total for {0}"; // don't update the screen while calculating the totals _flex.BeginUpdate(); // calculate three levels of totals _flex.Subtotal(AggregateEnum.Sum, 0, 1, totalOn, caption); _flex.Subtotal(AggregateEnum.Sum, 1, 2, totalOn, caption); _flex.Subtotal(AggregateEnum.Sum, 2, 3, totalOn, caption); _flex.Tree.Show(2); // auto-size the grid to accommodate the tree _flex.AutoSizeCols(1, 1, 1000, 3, 30, AutoSizeFlags.IgnoreHidden); // restore screen updates _flex.EndUpdate(); }