Is there a way of changing what group headers are shown depending on which columns have been grouped?
I have a small banking application which displays a breakdown of all fees.
AllFees.PNG shows all of the fees ungrouped
GroupedByDesk.PNG shows the desired behaviour of grouping on any column other than currency (sums all of the rows 'Amount' values exchanged into a single currency)
GroupedByCurrency shows the desired behaviour of grouping by currency alone (sums all of the amounts in that currency)
Where it gets more interesting is if you group by Currency and another column. The desired behaviour is to show ONLY the exchanged sum in the header down in each group, and child group etc., until the Currency grouping, where you ONLY display the currency sum, as demonstrated in GroupByDeskThenCurrency.PNG
I have some working code that prevents the exchanged sum aggregate being displayed (as long as the Currency is the first grouping), but it's still not quite what the desired outcome is. Said code:
private void GridView_Grouped(object sender, Telerik.Windows.Controls.GridViewGroupedEventArgs e)
{
foreach (Telerik.Windows.Controls.GridViewColumn col in this.GridView.Columns)
{
col.AggregateFunctions.Clear();
}
bool groupedByCurrency = false;
bool addedFxdSumAggregate = false;
foreach (ColumnGroupDescriptor gd in this.GridView.GroupDescriptors)
{
if (gd.DisplayContent.ToString() == "Currency")
{
groupedByCurrency = true;
this.GridView.Columns["Currency"].AggregateFunctions.Add(this.currSumFunction);
}
if (!groupedByCurrency && !addedFxdSumAggregate)
{
this.GridView.Columns[gd.DisplayContent.ToString()].AggregateFunctions.Add(this.fxableSumFunction);
addedFxdSumAggregate = true;
}
}