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
210
XamDataGrid Allow Summaries for just 1 Column
posted

Hey,

I wanted to know if there is a possible way, to allow summaries in a XamDataGrid for just one of the columns. And just average and sum. No maximum or minimum.
I know i can add SummaryDefinitions, but I not want to display the summaries all the time. 

It would be fantastic if there's a way to just show the sum-symbol in the columns I want and hide Maximum and Minimum in the popup.

  • 25665
    Verified Answer
    Offline posted

    Hello,

    Thank you for contacting Infragistics!

    To make it so only one column can have a summary you can setup field settings for just that field:

    <ig:Field Name="Department">
            <ig:Field.Settings>
                    <ig:FieldSettings AllowSummaries="True"></ig:FieldSettings>
            </ig:Field.Settings>
    </ig:Field>

    To have only Sum and Average appear in the dropdown list you can handle the SummarySelectionControlOpening and modify the list there:

    private void XamDataGrid1_SummarySelectionControlOpening(object sender, Infragistics.Windows.DataPresenter.Events.SummarySelectionControlOpeningEventArgs e)
    {
            e.Control.SummaryCalculatorHolders = e.Control.SummaryCalculatorHolders.Where(x => x.Calculator.Name == "Sum" || x.Calculator.Name == "Average");
    }