This is a migrated thread and some comments may be shown as answers.

[Solved] Custom Group Footer

1 Answer 165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
José
Top achievements
Rank 1
José asked on 12 Nov 2010, 05:29 PM
Hi,

Is it possible to create a custom group footer?
I'm able to do this for column footer but for the group footers I can only edit it's DataTemplate where i can't find which group footer i'm at (at this level we only get the AggregateResultCollection has datacontext).

I need this because i'm using a paginated item source where i might not have all the rows belonging to the group loaded and thus the group footer won't have the correct aggregated value for that group (since there are missing values).

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 18 Nov 2010, 08:17 AM
Hello José,


You may define your own GroupFooterTemplate in a similar manner that is shown in our online example:
<telerik:RadGridView ShowGroupFooters="True" AutoGenerateColumns="False" Margin="50,116,94,109" ItemsSource="{Binding Collection}">
        <telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn Header="Property1" DataMemberBinding="{Binding Property1}">
        <telerik:GridViewDataColumn.AggregateFunctions>
                            <telerik:AverageFunction Caption="Average: "/>
                            <telerik:CountFunction Caption="Count: "/>
                        </telerik:GridViewDataColumn.AggregateFunctions>
                 <telerik:GridViewDataColumn.GroupFooterTemplate>
            <DataTemplate>
                <StackPanel Orientation="Vertical" Margin="5">
                    <TextBlock Text="Custom group footer with aggregates: "/>
                    <telerik:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                    <TextBlock Text="{Binding Caption}" VerticalAlignment="Center"/>
                                    <TextBlock Text="{Binding FormattedValue}" VerticalAlignment="Center"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </telerik:AggregateResultsList>
                    </StackPanel>
                </DataTemplate>
            </telerik:GridViewDataColumn.GroupFooterTemplate>
        </telerik:GridViewDataColumn>
          </telerik:RadGridView.Columns>
   </telerik:RadGridView>


Also you may take a look at this forum thread.
If you need any further assistance let me know.


Sincerely yours,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
José
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or