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

GridView Column Aggregates

8 Answers 324 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Iain
Top achievements
Rank 1
Iain asked on 11 Dec 2014, 07:08 AM
I am trying and failing to show the group totals aligned with column headers. by setting the following properties ShowGroupHeaderColumnAggregates and ShowHeaderAggregates.

This the XAML I am using - am I doing something wrong or does it just not work? The property setters seem to have no effect.

<Window x:Class="GridViewTest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525"
    xmlns:t="http://schemas.telerik.com/2008/xaml/presentation">
    <Window.Resources>
        <Style TargetType="t:GroupHeaderRow">
            <Setter Property="ShowGroupHeaderColumnAggregates" Value="True" />
            <Setter Property="ShowHeaderAggregates" Value="False" />
        </Style>
    </Window.Resources>
    <Grid>
         <t:RadGridView ItemsSource="{Binding Path=Records}" SelectionMode="Extended">
         <t:RadGridView.GroupDescriptors>
             <t:GroupDescriptor Member="Column1" SortDirection="Ascending">
                 <t:GroupDescriptor.AggregateFunctions>
                     <t:CountFunction Caption="Entries count: " />
                     <t:FirstFunction Caption="First entry: " />
                 </t:GroupDescriptor.AggregateFunctions>
          </t:GroupDescriptor>
       </t:RadGridView.GroupDescriptors>
</t:RadGridView>
</Grid>

8 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 15 Dec 2014, 05:03 PM
Hi,

You need to set RadGridView's GroupRenderMode to Flat and define your aggregate functions on column level. Please check this online demo for a reference. The same example is available in your local copy of WPF demos.

I hope this helps.

Regards,
Yoan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Iain
Top achievements
Rank 1
answered on 16 Dec 2014, 08:01 AM
Thanks, adding GroupRenderMode worked...

However its not really what I wanted, what I would like to do is have aggregate values in line but aligned with the columns. Basically just like you get in other grids, excel pivots etc.

It seems to me that you either have aggregates in an additional row and an unnecessary group header or you have them in the group header but messily unaligned and unreadable?

Is this at all possible, without this standard grouping behavior I will be looking to use another grid?
0
Dimitrina
Telerik team
answered on 18 Dec 2014, 03:38 PM
Hello,

I understand what you mean. Regarding alignment of the group aggregates, I would suggest you to check the workaround suggested in the Group aggregate row header alignment forum thread. Still, we would recommend the built-in option explained by my colleague although it is indeed not exactly what you wish to have.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mark
Top achievements
Rank 1
answered on 18 May 2017, 02:51 PM
This demo is exactly what I need - except that I need this feature in WPF.  Can you supply a WPF version please?
0
Stefan
Telerik team
answered on 23 May 2017, 12:05 PM
Hello Mark,

Generally speaking, the approach of implementing such customization would be the basically same. You just need to remove the CompositeTransform from the template of the control and use one of the available mechanisms in WPF, as the CompositeTransform is present in Silverlight only. However, the presented solution is a customization which may not work as expected in all scenarios. Can you please clarify whether the built-in ShowGroupHeaderColumnAggregates property of the GroupHeaderRow is not an option for you?

Best Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Mark
Top achievements
Rank 1
answered on 23 May 2017, 12:50 PM

I've got this working in WPF now, but unfortunately it is not the answer.  The first aggregation goes into the header row as required, but all subsequent aggregations are placed on a footer row.  

Unfortunately ShowGroupHeaderColumnAggregates is no good either.  This creates a new row for each grouping, which produces twice as many rows as necessary.

If anyone can tell me how to have aggregation in the same line as the grouping, in columns, then I would be very grateful.  If I can't get this working I will have to continue using Component One which would be a shame.

0
Stefan
Telerik team
answered on 26 May 2017, 11:10 AM
Hello Mark,

Thanks for the update.

By the time being, there is no out-of-the-box mechanism for achieving such visual appearance. The only solution would be to modify the default template of the GridViewHeaderRow element(If you are using Flat GroupRenderMode. If you are using the older and default Nested one, the element would be GridViewGroupRow).

However, as we already have demand for providing a built-in mechanism for achieving this, we have logged it as a feature request. I will now raise its priority and we will try to provide it as soon as possible. You can track the state of the relevant item in the Feedback Portal: Implement the possibility to align the HeaderAggregates with the columns.

If further assistance is needed, feel free to approach me.

All the best,
Stefan X1
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Ivan Ivanov
Telerik team
answered on 30 May 2017, 02:56 PM
Hi,

Currently, we are exploring an idea for arranging the column group aggregates in a way that aligns them to the original columns that define them. It seems that the best option in terms of visual presentation is to make the group row a bit higher. Such change will be needed to prevent the first 1-2 columns' aggregates from overlapping with the group key (especially for groups with deeper level of nesting). It will be applied only when column aggregates are present and the new and the old behavior will be switchable by a property. The aggregates that are applied on group level (group descriptor), which are not associated with a particular column will still be listed on the right side of the group key. Can you please have a look at the attached picture which illustrates the idea (with 3 levels of grouping) and confirm whether such a behavior meets your requirements?

Regards,
Ivan Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Iain
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Iain
Top achievements
Rank 1
Dimitrina
Telerik team
Mark
Top achievements
Rank 1
Stefan
Telerik team
Ivan Ivanov
Telerik team
Share this question
or