views:

281

answers:

3

I have a DataGridView bound to a list of custom objects created on the fly. This list is not very large, 5000 items maximum. However, the values of the custom objects change every 50ms and the grid hangs the application while refreshing the values and it ultimately crashes.

My question is: is there a way to "virtualize" the data binding of the DataGridView so that only the rows that are actually seen on the screen are refreshed?

EDIT: I found out why my DataGridView was so slow and it had nothing to do with data binding. So this question is no longer relevant. As a side note, I think the DataGridView already refreshes only the visible rows when a ListChanged event occurs.

A: 

I think you will want to look into using the DataGridView in virtual mode.

Fredrik Mörk
+1  A: 

A good article on Virtual mode (DataGridView). - http://www.codeproject.com/KB/books/PresentDataDataGridView.aspx#7

adatapost
If I use this method, do I have to throw away databinding?
Julien Poulin
A: 

What is stopping you just pulling the visible sub-set of items instead of the full 5000?

philwilks
I am not pulling any data, the objects in the list are part of the functionality of the application.
Julien Poulin