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

Aggregate Result Display

29 Answers 427 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew Calhoun
Top achievements
Rank 1
Matthew Calhoun asked on 03 Dec 2010, 03:54 PM
Hi,

I am wondering if there is a way to disable the results of aggregate functions from being displayed in the headers? Or if not, can the results line up in the proper columns (instead of free-form text next to the header)?

Thanks,
Matt

29 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 03 Dec 2010, 04:06 PM
Hello Matthew Calhoun,

You may use the ShowHeaderAggregates Property and set it to "False". You may either set it as an implicit style targeting all grids:

<Grid.Resources>
    <Style TargetType="telerik:GridViewGroupRow">
        <Setter Property="ShowHeaderAggregates" Value="False"/>
    </Style>
</Grid.Resources>

Or define it explicitly using the GroupRowStyle property of the grid:
<Grid.Resources>
    <Style x:Key="MyGroupRowStyle" TargetType="telerik:GridViewGroupRow">
        <Setter Property="ShowHeaderAggregates" Value="False"/>
    </Style>
</Grid.Resources>
<telerik:RadGridView GroupRowStyle="{StaticResource MyCustomGroupRowStyle}">

  

All the best,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Matthew Calhoun
Top achievements
Rank 1
answered on 03 Dec 2010, 04:38 PM
Thanks Maya!

Just for curiosity, is there a way to align the aggregrates to the proper columns?

So, when grouped by year and summing Cost and Price, instead of:

Year                                                    Cost        Price
Year 1 $100 $200

I would want:

Year                                                    Cost            Price
Year 1                                                 $100            $200

Thanks,
Matt
0
Accepted
Maya
Telerik team
answered on 03 Dec 2010, 04:58 PM
Hi Matthew Calhoun,

For the time being there is no straight forward way for achieving it. In order to get the desired view with aligned aggregates, you need to predefine the GridViewGroupRowStyle a bit. I am sending you a sample project illustrating the proposed solution.
However, we do have plans on introducing this feature as a native one, but I cannot specify any time frame for that.
 

Regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Matthew Calhoun
Top achievements
Rank 1
answered on 03 Dec 2010, 05:13 PM
Wow...that's a lot of code vs something like 'ShowAggregratesInHeader="True"' :)

Thanks for the workaround...it seems to be working for me. I'm looking forward to the "native" version of this!

Take care,
Matt
0
jean-Marc
Top achievements
Rank 1
answered on 12 Mar 2011, 05:20 AM
Hi,
nice workaround while waiting for a native version.

By changing slightly as follow we can even have the aggregates function aligned in the Group row even when expanded.
Just thought some might prefer this version as I do.
<Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="aggregateResultsList">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Collapsed</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="toggleButton">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_GridViewVirtualizingPanel">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Footer">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation Duration="0" To="-1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="ExpanderButton" d:IsOptimized="True"/>
                                 
                                 
                            </Storyboard>

Regards
Jean-Marc
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Apr 2011, 04:14 PM
I don't find it in C# code
How do you do that let say rgvTest.??? Where's the ShowHeaderAggregates ?
0
Fabien
Top achievements
Rank 1
answered on 20 Sep 2011, 07:35 PM
I tried this workaround but found a bug with windows7 theme : groupped rows doesn't expand anymore.

Any solution ?

Thanks

Fabien
0
Maya
Telerik team
answered on 21 Sep 2011, 07:16 AM
Hi Fabien,

I have tried to reproduce the issue, but still without any success. Would you take a look at the sample attached to verify whether you can get the same behavior on it ? 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Fabien
Top achievements
Rank 1
answered on 21 Sep 2011, 02:39 PM
Hi Maya,

I don't see in your sample the "align the aggregrates to the proper columns" feature.
I use the code you provide in December, 2010 in this thread (attached file groupfooteringroupheader.zip) in my project to provide this feature.
In my project i have

StyleManager.ApplicationTheme = new Windows7Theme();
in the MainPage constructor. With that line, groupped rows doesn't expand anymore.
If i delete this line this works fine.
It seems that the GridViewGroupRowStyle you provide is theme-specific, so can you give me this style that works with window7theme ?
I'd be happy to do it if i had understood how you generate it (using blend ?)
Thx,

Fabien

 

0
Maya
Telerik team
answered on 22 Sep 2011, 12:12 PM
Hi Fabien,

Can you try the sample attached in my last reply - SilverlightApplication9.zip ? Do you get the same behavior on it ?
 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Fabien
Top achievements
Rank 1
answered on 22 Sep 2011, 04:47 PM
Hi,

Yes i have tried your sample. I thought you misunderstood my issue since your sample is not revelant because there is only one aggregate column and its the first. So it's hard to say if aggregates value in group headers are aligned with column header.
But i putted your code in my project and it's working fine now with window7 theme (All aggregates value appears under their column). Thanks.
But a issue remains : if i group by a column that contains text and doesn't have an aggregate function, this text doesn't appear in the group header. Any idea ?

You can check attached file for expected result. With your sample, nothing appear on first column.

I know that if you group by third Column (Phones), phone numbers in group headers will appear under "Name" Column, but i think it's better than not knowing the grouped value.

Thank you for your patience,

Fabien
0
Vanya Pavlova
Telerik team
answered on 23 Sep 2011, 12:20 PM
Hello Fabien,

 

If you take a look at the modified version of your project you may see a single ContentPresenter which Visibility is set to Collapsed. Once you remove this setting from the ContentPresenter's definition you would be able to see the Group keys as well:

<!--GroupHeader-->
                 
                        <ToggleButton  Grid.Column="1"
                                      grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
                                      Background="Transparent" BorderThickness="0" BorderBrush="{x:Null}"
                                      Style="{StaticResource GridViewGroupToggleButtonStyle}"
                                      IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsTabStop="{TemplateBinding IsTabStop}">
                        <ContentPresenter  x:Name="contentPresenter" Grid.Column="1"  Content="{TemplateBinding GroupViewModel}" ContentTemplate="{TemplateBinding GroupHeaderTemplate}"/>
                        </ToggleButton>


You may arrange this header in the way you need. 
Hope this helps! 


Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Fabien
Top achievements
Rank 1
answered on 23 Sep 2011, 02:47 PM
Hi,

Was watching around here but not seen the visibility attribute at the end of this long line.
I have the expected result now. Thanx a lot.

Fabien
0
Megan Vee
Top achievements
Rank 1
answered on 03 Oct 2011, 02:43 PM
Fabian - Apparently not yet: http://www.telerik.com/support/pits.aspx#/public/silverlight/4389
please vote.

0
Megan Vee
Top achievements
Rank 1
answered on 03 Oct 2011, 02:46 PM
Is there a way to move the aggregate to the group header (e.g. next to the group name - e.g. A. Datum Corporation).
And then remove the footer group?
TIA.
-M
0
Fabien
Top achievements
Rank 1
answered on 03 Oct 2011, 02:56 PM
Hi Megan,

The last project posted by Maya aim to solve your problem. It worked for me, have you tried it ?
The PITS issue that you mentioned is a feature request to have this functionality built-in.
i.e. replace the 3 xaml files in Maya's workaround by a single property on gridView like 'ShowAggregatesInGroupHeader=true' - unfortunatly not scheduled yet (i have already voted).

Fabien
0
Megan Vee
Top achievements
Rank 1
answered on 03 Oct 2011, 03:24 PM
Thanks Fabien - 
I hadn't downloaded the 2nd file - I misunderstood it's purpose. Thanks, I'll take a look.
-Megan
0
Megan Vee
Top achievements
Rank 1
answered on 03 Oct 2011, 04:38 PM
Fabien, Maya, et al - 
The SilverlightApplication9 works in that it puts the aggregates above the group as requested.
But now, how do I get the group name on that row as well?
Any help is greatly appreciated.
Thank you,
Megan
0
Fabien
Top achievements
Rank 1
answered on 03 Oct 2011, 04:53 PM
See last post of Vanya Pavlova : Find the red line in your code and supress the visibility attribute.

0
Megan Vee
Top achievements
Rank 1
answered on 04 Oct 2011, 08:51 AM
Thanks Fabien! Apparently, I'm blind. :) That worked perfectly
-M
0
Megan Vee
Top achievements
Rank 1
answered on 04 Oct 2011, 01:38 PM
Fabien - 
One last question: If requested, were you able to resize the group column?
e.g., in the screen shot, resize the name column so it isn't 'on top' of the Company aggregate.
Almost there... :)
-M
 
0
Megan Vee
Top achievements
Rank 1
answered on 05 Oct 2011, 10:43 AM
FYI - added this code to expand column so that grouped name is visible
The border lines are still in the way, especially if more than one group is added, but it works for now.
private void MyGridView_Grouping(object sender, GridViewGroupingEventArgs e)
        {
            //placing group or removing a group when there is more than one group already
            if (e.Action == GroupingEventAction.Place || CurrentGridView.GroupCount > 1)
            {
                CurrentGridView.Columns[0].Width = 200;
            }
            else
            {
                CurrentGridView.Columns[0].Width = 25;
            }
        }
-M
0
Dirk Liebich
Top achievements
Rank 1
answered on 01 Nov 2011, 01:36 AM
Hey I know this is kind of the wrong place for it, but does anyone know if this will also work in WPF?  I've done my best to massage the code found in MainPage.xaml in the GroupHeaderInGroupFooter solution that was posted above, but I must be missing something.  This thread seems to be the furthest along for a solution to having the Aggregated Rows line up. 
0
Maya
Telerik team
answered on 01 Nov 2011, 07:41 AM
Hi Dirk Liebich,

I have just replied to the other forum thread you posted on the same topic and attached a sample project illustrating the above-mentioned workaround for WPF.
Let me know in case you need any further assistance.
 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Chandra
Top achievements
Rank 1
answered on 19 Sep 2012, 12:26 PM
The example Worked fine for me, but there is a minor issue with expander image.
If the RadGrid has many columns and I scroll the grid horizontally the expander image just scrolls out of screen to the left while the group name still holds it's place and also the group expands and collapses if I click on the blank area where the expander image was supposed to be.
Please Help !
Thanks-
Chandra

0
Maya
Telerik team
answered on 20 Sep 2012, 07:06 AM
Hi Purna,

Will it be possible to clarify a bit the case - which example you are referring to ? Furthermore, since this forum thread targets Silverlight, while the link in my last reply points out to our WPF forums, which platform are you working with ? What is your exact implementation ?  

Greetings,
Maya
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Chandra
Top achievements
Rank 1
answered on 20 Sep 2012, 07:26 AM
Thanx for replying, but I already tweaked the template and got the look I needed.
0
Fabien
Top achievements
Rank 1
answered on 05 Nov 2012, 09:20 PM
Hi again !

It seems that IE10 users are reporting that numeric values are not correctly summed anymore. It still works fine on my IE 9.

Any Idea ?

0
Maya
Telerik team
answered on 06 Nov 2012, 08:13 AM
Hello Fabien,

Will it be possible to clarify a bit  - are your aggregates not calculated correctly ? Generally, this functionality should not be related to the version of the browser you are working with ? Is that reproducible with our demos ?  

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Matthew Calhoun
Top achievements
Rank 1
Answers by
Maya
Telerik team
Matthew Calhoun
Top achievements
Rank 1
jean-Marc
Top achievements
Rank 1
Marc Roussel
Top achievements
Rank 2
Fabien
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Megan Vee
Top achievements
Rank 1
Dirk Liebich
Top achievements
Rank 1
Chandra
Top achievements
Rank 1
Share this question
or