Row Summaries or Row Aggregation is a feature that is enabled on the XamDataGrid quickly and easily by setting a couple of properties. The first property that needs to be set is the “AllowSummaries.” This property is off of the FieldSettings Object. By setting this property to true; the end user is now able to have a drop down button that shows a collection of standard summaries. (This is customizable and your own custom calculation could be added.)
<igDP:XamDataGrid x:Name="xamDataGrid1" DataSource="{Binding}"> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.FieldSettings> <igDP:FieldSettings AllowSummaries="True" SummaryUIType="Default" /> </igDP:FieldLayout.FieldSettings> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
The next property of importance to the row summary capabilities is the SummaryUIType property. This property defines whether the end-user is able to select a single calculation or multiple (e.g. Count and Sum or only Count). The enumeration for this property has five values:
The last core property for Row Summaries in the XamDataGrid is the SummaryDisplayArea property. This, like the name implies, controls how and where summaries are displayed. The enum for this property contains eight possibilities:
Lastly, all of the above properties can be set procedurally as follows:
using Infragistics.Windows.DataPresenter; ... this.xamDataGrid1.FieldSettings.AllowSummaries = true; this.xamDataGrid1.FieldSettings.SummaryUIType = SummaryUIType.MultiSelect; this.xamDataGrid1.FieldSettings.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRecords | SummaryDisplayAreas.BottomFixed; ...