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
1360
Performance of adding column summaries in code behind
posted

Hi all,

I am trying to see if I can improve the performance of adding default summaries to multiple int/decimal column using code behind. It is all working fine, but the performance tails off dramatically when the number of columns gets above about 50. In an extreme test, adding summaries to 300 columns (I said extreme...) it takes around 30 seconds on a very fast machine with CPU pegging fully.

I have tried binding the itemsource to an empty list of the appropriate object and then doing the summaries but it doesnt seem to help. Are there any performance improvements anyone can suggest to speed this up?

The code to add summaries is below:

private void SetupColumnSummaries()
{
    foreach (Column col in this.MyDataGrid.Columns)
    {
        if (col.DataType == typeof(Int32) || col.DataType == typeof(decimal) || col.DataType == typeof(double))
        {
            var summary = col.SummaryColumnSettings.SummaryOperands[3];
            summary.FormatString = "{0:N0}";
            summary.IsApplied = true;
        }
        else
        {
            col.IsSummable = false;
        }
    }
}

Parents
No Data
Reply
  • 21382
    posted

    The most likely cause is that every time you add a summary the summary will force the grid to reprocess it's data.  As such you would propably want to set up your columns prior to binding to your data, even better if you could set it up in XAML.

     

    Otherwise at this time there is not much that can be done.  

     

    i will have support open a ticket on this issue.

Children