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

Custom Grouping and Aggregate functions

3 Answers 84 Views
GridView
This is a migrated thread and some comments may be shown as answers.
gisela
Top achievements
Rank 1
gisela asked on 09 Sep 2014, 08:48 AM
In the RadGridView control i have a custom groupfunction:

void Grid_Grouping (object sender, GridViewGroupingEventArgs e)
         {
             if (e.Action == GroupingEventAction.Place)
             {
                 var column = e.GroupDescriptor as Telerik.Windows.Controls.GridView.ColumnGroupDescriptor;
                 if (column! = null)
                 {
                     if (column.Column.UniqueName == "WeekDay")
                     {
                         e.Cancel = true;

                         var descriptor = new GroupDescriptor <VMDashBoardDataPoint, string, int>

                         {

                             GroupingExpression = i => i.DayOfWeek,

                             GroupSortingExpression = i => (i.FirstOrDefault () Ist.TimeRange.Start.DayOfWeek == (int) DayOfWeek.Sunday 7.? (Int) i.FirstOrDefault () Ist.TimeRange.Start.DayOfWeek.)

                         };

                         descriptor.DisplayContent = ((Telerik.Windows.Data.GroupDescriptorBase) (e.GroupDescriptor)) display content.

                         descriptor.SortDirection = e.GroupDescriptor.SortDirection;
                         this.Grid.GroupDescriptors.Add (descriptor);
                     }
                 }

             }
         }

Everything works except the Aggregate Functions. 
How can this function be changed, so that Aggregate Functions work?


Best regards

Gisela Fromm 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Sep 2014, 11:11 AM
Hello Gisela,

I checked the code snippet and I am not seeing any code related to aggregate functions. May I ask you to share some more information on how have you defined those functions?

Generally there is an option to directly add AggregateFunctions for the specific GroupDescritor through its descriptor.AggregateFunctions collection.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
gisela
Top achievements
Rank 1
answered on 10 Sep 2014, 11:44 AM
Hello Didie,

the Aggregate Functions are defined in xaml, see attached Picture.


Best regards
Gisela


0
Dimitrina
Telerik team
answered on 11 Sep 2014, 10:57 AM
Hello Gisela,

I tested defining column aggregates in XAML and then replacing the default GroupDescriptor with my own similarly to how you do so when the Grouping event is raised. The aggregates are still calculated fine in my test project. I am testing with our latest official version: 2014.2 729. 

Would you please open a new support thread and attach a demo project illustrating the issue there? You can take a look at this blog post for a reference on how to isolate an issue. 

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
gisela
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
gisela
Top achievements
Rank 1
Share this question
or