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

4 posts, 1 answers
  1. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 22 Jun 2010 Link to this post

    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.
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 23 Jun 2010 Link to this post

    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
  3. DevCraft banner
  4. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 23 Jun 2010 Link to this post

    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...
  5. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 29 Jun 2010 Link to this post

    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
Back to Top