Component One Silverlight FlexGrid Tip 4 (Group Aggregate)

In the previous blog we looked at performing simple grouping. While grouping is interesting, most of the time you group them and to see some king of group aggregation. Component One provides following group aggregates to be performed on any given column definition.

  1. Average
  2. Count
  3. Maximum
  4. Minimum
  5. None
  6. Range
  7. Std
  8. StdPop
  9. Sum
  10. Var
  11. VarPop

Lets all of these in action, we will take our favorite Person class we used in the previous example for simple grouping and add all aggregation on the Age and see what does it create

<c1:C1FlexGrid Name="flexGrid" ItemsSource="{Binding PeopleCollection}" AutoGenerateColumns="False" >
   <c1:C1FlexGrid.Columns>
     <c1:Column Binding="{Binding Name}"/>
     <c1:Column Binding="{Binding Age}" Header="Average" GroupAggregate="Average"/>
     <c1:Column Binding="{Binding Age}" Header="Count" GroupAggregate="Count"/>
     <c1:Column Binding="{Binding Age}" Header="Maximum" GroupAggregate="Maximum"/>
     <c1:Column Binding="{Binding Age}" Header="Minimum" GroupAggregate="Minimum"/>
     <c1:Column Binding="{Binding Age}" Header="None" GroupAggregate="None"/>
     <c1:Column Binding="{Binding Age}" Header="Range" GroupAggregate="Range"/>
     <c1:Column Binding="{Binding Age}" Header="Std" GroupAggregate="Std"/>
     <c1:Column Binding="{Binding Age}" Header="StdPop" GroupAggregate="StdPop"/>
     <c1:Column Binding="{Binding Age}" Header="Sum" GroupAggregate="Sum"/>
     <c1:Column Binding="{Binding Age}" Header="Var" GroupAggregate="Var"/>
     <c1:Column Binding="{Binding Age}" Header="VarPop" GroupAggregate="VarPop"/>
   </c1:C1FlexGrid.Columns>
</c1:C1FlexGrid>

 

All of them are self explanatory on what it does. The default behaviour is None. If you do not have a group aggregate for a column, it will default it to None so that no group aggregation will not happen.

image