Completed
Last Updated: 04 Feb 2022 09:05 by ADMIN
Release LIB 2022.1.207 (7 Feb 2022)
Martin Ivanov
Created on: 21 Jan 2022 11:15
Category: GridView
Type: Bug Report
1
GridView: Aggregate results in the group header are not updated when adding or removing columns

GridView allows you to define an AggregateFunction for each column and display the summary information for all cells in the column when there is grouping enabled. This will produce a group header with an aggregate result for each column that has aggreagate functions defined.

Adding and removing columns from the RadGridView's Columns collection doesn't update the aggregate results displayed in the group header.

To work this around, you can remove the GroupDescriptor from the GridView control and add a new instance of the descriptor, when you add/remove an item.

private void RadButton_Click_1(object sender, RoutedEventArgs e)
{
	var column = new GridViewDataColumn() { DataMemberBinding = new System.Windows.Data.Binding("Number1") };
	column.AggregateFunctions.Add(new SumFunction());
	this.gridView.Columns.Add(column);
	
	var descriptor = (GroupDescriptor)this.gridView.GroupDescriptors[0];
	this.gridView.GroupDescriptors.Remove(descriptor);
	this.gridView.GroupDescriptors.Add(new GroupDescriptor() { Member = descriptor.Member });
}

0 comments