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

How to stop group footer content from displaying in group headers?

3 Answers 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jonx
Top achievements
Rank 2
Jonx asked on 22 Jun 2010, 04:52 PM
Hello,
I'm not sure I use the right vocabulary so see the attached screenshot...

I want to have a different  group header content then footer content.

I know how to customize the group header for a given group only when the lines are grouped by that column.

For exemple this will write the column text to green when I group my data by that column:
<telerik:GridViewDataColumn.GroupHeaderTemplate>
                            <DataTemplate>
                                <TextBlock Foreground="Green" Text="{Binding Group.Key}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.GroupHeaderTemplate>
But this does only count for the grouped column, then after this one, the content of the other group footers gets added automaticaly. And I don't want it to...

Any idea of how to stop things from being added after my group header template?

Thanks a lot in advance,
John.

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 23 Jun 2010, 10:29 AM
Hi John,

That can be achieve with a simple style for GridViewGroupRow :

<Style TargetType="telerik:GridViewGroupRow" x:Key="CustomGroupStyle">
    <Setter Property="ShowHeaderAggregates" Value="False"/>
</Style>

<telerik:RadGridView Grid.Row="0"  GroupRowStyle="{StaticResource CustomGroupStyle}"        Margin="5">


Kind regards,
Milan
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
0
Jonx
Top achievements
Rank 2
answered on 23 Jun 2010, 11:10 PM
Thanks Milan but your solution is a all or nothing choice...
I actually like the feature and need to use it.

I'd like to have the grid footer, the group footers and the group row (if that is the correct name of the thing) all show different info, text and aggregates...

I could eventually live with the fact that both footers display the same info but I need to customize what is displayed on the group row...

Any way to achieve this? Thanks...
0
Accepted
Milan
Telerik team
answered on 29 Jun 2010, 01:36 PM
Hello John,

Now I understand your requirements. This could be achieved by adding a GroupDescriptor in code-behind - in this situation the grid will ignore the aggregate functions of all columns and only display its aggregate results. There is a catch though - the GroupDescriptor should be added after the grid has initialized its date. Hopefully this will not be an impediment for your project:

// subscribe to the Loaded event of the grid
void playersGrid_Loaded(object sender, RoutedEventArgs e)
{
    var groupDescriptor = new GroupDescriptor() { Member = "Number" };
    groupDescriptor.AggregateFunctions.Add(new CountFunction());
  
    this.Dispatcher.BeginInvoke(new Action(() => this.playersGrid.GroupDescriptors.Add(groupDescriptor)));
}


Kind regards,
Milan
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
Jonx
Top achievements
Rank 2
Answers by
Milan
Telerik team
Jonx
Top achievements
Rank 2
Share this question
or