RadControls for WPF

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:

Note

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

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

CopyXAML
<telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}"
                                        Header="ID"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                        Header="Name"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}"
                                        Header="Title"
                                        UniqueName="Title" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Enable Group Footers Functionality

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

CopyXAML
<telerik:RadGridView x:Name="radGridView" ShowGroupFooters="True">

Note

The default value of the ShowGroupFooters property is False.

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

CopyC#
private void EnableGroupFooters()
{
    this.radGridView.ShowGroupFooters = true;
}
CopyVB.NET
Private Sub EnableGroupFooters()
    Me.radGridView.ShowGroupFooters = True
End Sub

Set the Group Footers Content

  • Using the GroupFootersTemplate.

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

CopyXAML
<UserControl.Resources>

    <DataTemplate x:Key="GroupFooterTemplate">
        <TextBlock Text="Hello"/>
    </DataTemplate>

</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
        <telerik:RadGridView.Columns>
            <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" />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
</Grid>

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

CopyXAML
<telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False" ShowGroupFooters="True">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}" Header="ID">
            <telerik:GridViewDataColumn.AggregateFunctions>
                <telerik:CountFunction Caption="Total: "/>
            </telerik:GridViewDataColumn.AggregateFunctions>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" Header="Title" UniqueName="Title" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

The result can be seen on the next image.

Note

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 the RadGridView's grouping functionality.

See Also