Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I temporarily prevent manual changes to a DataGridView from updating the underlying data source?
    primarykey
    data
    text
    <p>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.</p> <p>Basically, I've got a <code>DataGridView</code>, which is bound to a <code>BindingList&lt;T&gt;</code>. 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.</p> <p>Based on prior experience, I am fairly confident the performance can be greatly improved by manually updating <strong>just the visible cells</strong> in the <code>DataGridView</code> on a timer rather than implementing <code>INotifyPropertyChanged</code> (not really a feasible option as many of the values in this grid are changing dozens of times per second) or calling <code>Refresh</code>. But there's a problem: if I manually update the cells in the grid one by one, every update triggers the <code>set</code> of the corresponding property for the databound object, which, added up, incurs a significant drain in performance.</p> <p>It really isn't necessary to make all these <code>set</code> calls, as the values I'm putting in the grid's cells are retrieved directly <em>from</em> those properties (so I'm basically reading a value and then writing it back to itself).</p> <p>It would be nice if I could temporarily disable this functionality of the <code>DataGridView</code>: 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 <em>user's</em> updates <em>do</em> affect the data source.</p> <p>I tried using a <code>BindingSource</code> with its <code>DataSource</code> property set to the <code>BindingList&lt;T&gt;</code> and calling <code>SuspendBinding</code>/<code>ResumeBinding</code>; but that didn't seem to work. The <code>set</code> calls continued to be made.</p> <p>Is there some way to accomplish what I'm going for here? Am I walking down the wrong path entirely?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload