I am loading a large datasource into a XamDataGrid and in the FieldLayoutInitialized event handler I'm defining some SummaryDefinition based on Property Attributes.
foreach (var columnDetailsAttribute in attributes.Where(attribute => attribute.TotalsBy || attribute.AverageBy)){ var summaryDefinition = new SummaryDefinition(); summaryDefinition.SourceFieldName = columnDetailsAttribute.PropertyName; summaryDefinition.Calculator = columnDetailsAttribute.TotalsBy ? (SummaryCalculator) Infragistics.Windows.DataPresenter.SummaryCalculator.Sum : Infragistics.Windows.DataPresenter.SummaryCalculator.Average; e.FieldLayout.SummaryDefinitions.Add(summaryDefinition);}
this works fine.
However I would like to turnoff or not define the SummaryDefinition if the grouping only has one group.
Hello ahrensd,
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
I have been looking into your issue.
Currently the Grouping and Grouped event of the XamDataGrid fire when the user groups the records through the UI. More about those events you can find on the following link from our documentation:
http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v15.1~Infragistics.Windows.DataPresenter.XamDataGrid_members.html.
If you want to set the FieldSortDescription in the FieldLayoutInitialized I could suggest using the Loaded event of the XamDataGrid to check the items in a group.
Please do not hesitate to let me know if you have any further questions on this matter.
Have used this code for my application and it doesn't work when you programmiclly add the FieldSortDescription's in the FieldLayoutInitialized.
Close but doesn't call igDataGrid_Grouping in this case.
Hello David,
Thank you for the feedback. I am glad that you have found a solution to your issue.
I have been looking into your question about putting this functionality directly in the library - if you would like this functionality to be included as a built-in functionality in our controls in a future version I can suggest creating a new Product Idea on the following site http://ideas.infragistics.com.
If you create a new Product Idea you would be able to discuss this functionality with our developers. Also you would receive notifications regarding the status of the idea.
Thanks for your time Gergana,
Your modified code didn't quite cut it, but did put me on the right track, which I would never of found without your help.
After some further alterations I have something that behaves how I wanted.
Any improvements welcomed, how about putting the functionality directly in the library?
Regards David