I tried to find another question like this one, since it certainly seems like something that may have been asked before; but I couldn't find it.
Basically, I've got a DataGridView
, which is bound to a BindingList<T>
. I understand that in general, data binding is very nice and saves a lot of (our -- developers') time. However, there is a significant performance issue with this grid, which is very large.
Based on prior experience, I am fairly confident the performance can be greatly improved by manually updating just the visible cells in the DataGridView
on a timer rather than implementing INotifyPropertyChanged
(not really a feasible option as many of the values in this grid are changing dozens of times per second) or calling Refresh
. But there's a problem: if I manually update the cells in the grid one by one, every update triggers the set
of the corresponding property for the databound object, which, added up, incurs a significant drain in performance.
It really isn't necessary to make all these set
calls, as the values I'm putting in the grid's cells are retrieved directly from those properties (so I'm basically reading a value and then writing it back to itself).
It would be nice if I could temporarily disable this functionality of the DataGridView
: for a time, turn off the feature responsible for updating the underlying data source based on updates to the grid. Then, when I'm finished updating it manually, turn that feature back on so that the user's updates do affect the data source.
I tried using a BindingSource
with its DataSource
property set to the BindingList<T>
and calling SuspendBinding
/ResumeBinding
; but that didn't seem to work. The set
calls continued to be made.
Is there some way to accomplish what I'm going for here? Am I walking down the wrong path entirely?