In the documentation for SummaryCalculators, it indicates there are 5 default calculators, but I am only getting 3 of those.. Count, Min and Max. How can I show the Sum and Average calculators in the dropdown Summary selector?
Thanks
This example shows that the SummaryCalculator.Sum exists, but if the user opens the Summary drop down, only Count, Min and Max are shown as options.
<igDP:XamDataGrid MinHeight="200" AutoFit="True" BindToSampleData="True" > <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.SummaryDefinitions> <igDP:SummaryDefinition Calculator="{x:Static igDP:SummaryCalculator.Sum}" StringFormat="{}{1} = {0:c}" DisplayArea="Bottom" Key="SalarySum" Position="UseSummaryPositionField" SourceFieldName="salary"/> </igDP:FieldLayout.SummaryDefinitions> <igDP:FieldLayout.Fields> <igDP:Field Name="name"/> <igDP:Field Name="salary"> <igDP:Field.Settings> <igDP:FieldSettings AllowSummaries="True"/> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
In your snippet you're using the BindToSampleData. That sample data source is an xml document and as such the data type of the fields will be string. Sum and Average do not work with string datatypes. You can set the EditAsType on the FieldSettings of the salary field to sys:Decimal or another numeric type (where sys is defined as the following namespace - xmlns:sys="clr-namespace:System;assembly=mscorlib").
Thank you for the reply, Andrew. I has a hunch it was because of the datatype. I just didn't see the property in the FieldSettings. Thanks.