<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
	x:Class="GroupAggregates.MainPage"
	Width="640" Height="480">

	<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
		<telerik:RadGridView Margin="56,24,72,48" AutoExpandGroups="True" ShowColumnFooters="True" AutoGenerateColumns="False" ShowGroupFooters="True" ItemsSource="{Binding Collection}">
			
			<telerik:RadGridView.Columns>
				<telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding Property1}">
					<telerik:GridViewDataColumn.AggregateFunctions>
						<telerik:CountFunction Caption="Total:"/>
						</telerik:GridViewDataColumn.AggregateFunctions>
					<telerik:GridViewDataColumn.GroupFooterTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Vertical">
                                <TextBlock Text="Some Text"/>
                                <telerik:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock VerticalAlignment="Center" Text="{Binding FormattedValue}"/>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Vertical"/>
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                </telerik:AggregateResultsList>
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.GroupFooterTemplate>
					</telerik:GridViewDataColumn>
				<telerik:GridViewDataColumn Header="IsTrue" DataMemberBinding="{Binding Property2}"/>
				<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Property3}"/>
				<telerik:GridViewDataColumn Header="CompanyName" DataMemberBinding="{Binding Property4}"/>
				</telerik:RadGridView.Columns>
			</telerik:RadGridView>
	</Grid>
</UserControl>