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
280
Expand all records excessively slow?
posted

I have a grid with some 800 records, and each record having a "sub-record" containing 1- ~30 items.

Now if I create a button handler doing nothing else but looping through xamDataGrid1.Records and setting IsExpanded=true for each record I wait for nearly a minute with one processor core maxed out.

This is not really usable performance, am I doing something wrong?

Using version 9.1.20091.2023

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    This is true to some extent. On my laptop the whole process is completed in less than 10 seconds, but that is also not satisfactory. It really depends on the hardware. But why do you need to expand all the 800 records, while you can see (for example) 10 at the most?

    It is only enough to expand the ones that are currently in view and then expand those who come into view.

    You can do this in couple of ways - either RecordsInViewChanged event or InitializeRecord event.

    For example, you can use the InitializeRecord event and handle it like this:

     

    void xamDataGrid1_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs 
    {
    if (shouldExpand)
    {  
    e.Record.IsExpanded = true;
    }
    }

    and your button handler only sets this shouldExpand property to true:

    private void button1_Click(object sender, RoutedEventArgs e)

            {

                shouldExpand = true;

                xamDataGrid1.DataSource = null;

                xamDataGrid1.DataSource = s;

            }

    Rebinding the grid would be much more faster than expanding all the records.

    Regards,

    Alex.

     

Children