Group Footers

RadGridView exposes group footers features which provide the option to render a footer under each group in the grid. Group footers display group summaries and contain footer cells that correspond to data columns.

This tutorial will walk you through the common tasks of:

Before continuing with this topic make sure that you are familiar with the Visual Structure of RadGridView.

For the purpose of this tutorial the following declaration will be used:

<telerik:RadGridView AutoGenerateColumns="False"> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}" 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" 
                                UniqueName="Title" /> 

Enable Group Footers Functionality

In order to enable the group footers functionality, merely set ShowGroupFooters property of RadGridView to True.

<telerik:RadGridView ShowGroupFooters="True" /> 

The default value of ShowGroupFooters property is False.

The same operation can be done in the code-behind.

private void EnableGroupFooters() 
    this.radGridView.ShowGroupFooters = true; 
Private Sub EnableGroupFooters() 
    Me.radGridView.ShowGroupFooters = True 
End Sub 

Set the Group Footers Content

  • Using GroupFootersTemplate.

If you want your group footers to have a static content, simply configure GroupFootersTemplate property.

    <DataTemplate x:Key="GroupFooterTemplate"> 
        <TextBlock Text="Hello"/> 
<Grid x:Name="LayoutRoot" Background="White"> 
    <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False"> 
            <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}" Header="ID"     GroupFooterTemplate="{StaticResource GroupFooterTemplate}"/> 
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"/> 
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" Header="Title" UniqueName="Title" /> 

The group footers are most commonly used to visualize calculations from aggregate functions within the scope of the current group. Consider the following example:

<telerik:RadGridView AutoGenerateColumns="False" ShowGroupFooters="True"> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}" Header="ID"> 
                <telerik:CountFunction Caption="Total: "/> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"/> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" Header="Title" UniqueName="Title" /> 
The result can be seen on the next image.

RadGridView will calculate aggregates over the entire data source and will respect the filter expression applied (if present).

Styling Group Footers

If you want to learn how to style group footers take a look at the Styling Group Footers topic.

Check out the following topics which explain in great details RadGridView's grouping functionality.

Re-defining Group Aggregates

You can modify the default template of displaying group aggregates by applying a new GroupFooterTemplate configured it per specific requirements.

        <StackPanel Orientation="Vertical" 
            <TextBlock Text="Custom footer with aggregates:" 
                       Margin="0,0,0,2" /> 
            <telerik:AggregateResultsList ItemsSource="{Binding}" 
                        <StackPanel Orientation="Horizontal" 
                                       Text="{Binding Caption}" /> 
                                       Text="{Binding FormattedValue}" /> 
                        <StackPanel Orientation="Vertical" /> 

The GroupFooter's DataContext is AggregateResultsList.

See Also

In this article
Not finding the help you need? Improve this article