Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1255
Default Summary Calculators Sum and Average not showing in dropdown
posted

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>

Parents
  • 54937
    Verified Answer
    Offline posted

    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").

Reply Children
No Data