All,
Is there a way in the 9.1 UltraWinGrid to automatically expand all rows when the user groups by a new column. My users want the grid to automatically expand all rows whenever they drag/drop a column header to the "Group By" box. Is there a property or an event I can trap that allows me to know when this happens? I thought that the "AfterSortChange" event might work, but it tells me the band that changed and not necessarily the column...
Thanks,Jason
Mike,
Thanks. I'll give it a shot.
Jason
Hi Jason,
You can keep track of the number of grouped columns in the BeforeSortChange, then see if it increased in the AfterSortChanged.
int groupedColumnsCount = 0; private void ultraGrid1_BeforeSortChange(object sender, BeforeSortChangeEventArgs e) { this.groupedColumnsCount = 0; foreach (UltraGridColumn column in e.Band.SortedColumns) { if (column.IsGroupByColumn) groupedColumnsCount++; } } private void ultraGrid1_AfterSortChange(object sender, BandEventArgs e) { int newGroupedColumnsCount = 0; foreach (UltraGridColumn column in e.Band.SortedColumns) { if (column.IsGroupByColumn) newGroupedColumnsCount++; } if (newGroupedColumnsCount > this.groupedColumnsCount) { UltraGrid grid = (UltraGrid)sender; grid.Rows.ExpandAll(true); } }
Actually, since BeforeSortChanged gives you both the band and the new SortedColumns, you could potentially count both in BeforeSortChanged and then just set a flag to expand everything in AfterSortChanged. But it doesn't really make much difference.