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
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
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
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.
Maya
the Telerik team
Thanks for the workaround...it seems to be working for me. I'm looking forward to the "native" version of this!
Take care,
Matt
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
How do you do that let say rgvTest.??? Where's the ShowHeaderAggregates ?
Any solution ?
Thanks
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 ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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
Can you try the sample attached in my last reply - SilverlightApplication9.zip ? Do you get the same behavior on it ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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
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 >>
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
please vote.
And then remove the footer group?
TIA.
-M
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
I hadn't downloaded the 2nd file - I misunderstood it's purpose. Thanks, I'll take a look.
-Megan
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
-M
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
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;
}
}
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.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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
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 ?
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.
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 ?
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 ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.