DataGrid Selecting Item too slow

Jul 29, 2009 at 6:45 PM

Hi,

 

I have 5 000 items in list and selecting one of them takes about 5-6 seconds... 

If I put 50 000 items it takes even more ~ 30sec and so on...

 

50 000 of same entities in WinForm datagrid works momentaly...

 

p.s. debuging positions me in method:

private void SelectItem(object item, bool selectCells)

        {
            if (selectCells)
            {
                using (UpdateSelectedCells())
                {
                    int itemIndex = Items.IndexOf(item);
                    int numColumns = _columns.Count;
                    if ((itemIndex >= 0) && (numColumns > 0))
                    {
                        _selectedCells.AddRegion(itemIndex, 0, 1, numColumns);
                    }
                }
            }
            UpdateSelectedItems(item, /* Add = */ true);
        }
private void SelectItem(object item, bool selectCells)
on line of code that eats all the time ...
int itemIndex = Items.IndexOf(item);

How to solve this ?

 

Thanks, Alex.M