# 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:

* [Enabling the group footers functionality](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/group-footers#enable-group-footers-functionality)

* [Setting the group footers content](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/group-footers#set-the-group-footers-content)

* [Styling the group footers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/group-footers#styling-group-footers)

* [Re-defining Group Aggregates](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/group-footers#re-defining-group-aggregates)

> Before continuing with this topic make sure that you are familiar with the [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radgridview/general-information/visual-structure) of **RadGridView**.

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

```XAML
<telerik: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 **ShowGroupFooters** property of **RadGridView** to **True**.

```XAML
<telerik:RadGridView ShowGroupFooters="True" />
```

![Telerik UI for WPF RadGridView with group footers enabled beneath each grouped section](https://www.telerik.com/products/wpf/documentation/assets/170c4d37213a7fa494ca561d6a1450c1/radgridview_grouping_groupfooters_010.png)

> The default value of **ShowGroupFooters** property is **False**.

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

```C#
private void EnableGroupFooters()
{
    this.radGridView.ShowGroupFooters = true;
}
```

```VB.NET
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.

```XAML
<Grid.Resources>
    <DataTemplate x:Key="GroupFooterTemplate">
        <TextBlock Text="Hello"/>
    </DataTemplate>
</Grid.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>
```

![Telerik UI for WPF RadGridView group footer showing static template content](https://www.telerik.com/products/wpf/documentation/assets/d747a33c634a90a08070e602509e064a/radgridview_grouping_groupfooters_020.png)

* Using [Aggregate Functions](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/aggregate-functions).

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

```XAML
<telerik: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.

![Telerik UI for WPF RadGridView group footer displaying aggregate results for the current group](https://www.telerik.com/products/wpf/documentation/assets/bcf4cb2063ad7804604ae96ac0a22ccc/radgridview_grouping_groupfooters_030.png)

> **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](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-group-footers) topic.

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

* Learn the [basic](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/basics) of the grouping behavior.

* Using group [aggregates](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/aggregates).

* [Implement](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/programmatic-grouping) programmatic grouping.

## Re-defining Group Aggregates

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

```XAML
<telerik:GridViewDataColumn.GroupFooterTemplate>
    <DataTemplate>
        <StackPanel Orientation="Vertical"
                    Margin="0,10">
            <TextBlock Text="Custom footer with aggregates:"
                       Margin="0,0,0,2" />
            <telerik:AggregateResultsList ItemsSource="{Binding}"
                                          VerticalAlignment="Center"
                                          Grid.Column="4">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal"
                                    VerticalAlignment="Center">
                            <TextBlockVerticalAlignment="Center"
                                       Text="{Binding Caption}" />
                            <TextBlockVerticalAlignment="Center"
                                       Text="{Binding FormattedValue}" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </telerik:AggregateResultsList>
        </StackPanel>
    </DataTemplate>
</telerik:GridViewDataColumn.GroupFooterTemplate>
```

> The GroupFooter's DataContext is **AggregateResultsList**.

## See Also

* [Aggregate Functions](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/aggregate-functions)
* [Basic Filtering](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/basic)
* [Programmatic Filtering](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/programmatic)
