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
590
Deeper performance questions
posted

I have read the WinGrid Performance Guide, and I still have a few questions.

I have a grid bound to an UltraDataSource.
Does calling ultraDataSource.SuspendBindingNotifications() have the same effect as calling ultraGrid.BeginUpdate() and SuspendRowSynchronization()?
Should I do both, or stick to one or the other?


When setting cell values on the dataSource, is there a performance difference between any of the following variants:

ultraDataRow[integerColumnIndex] = someValue;
ultraDataRow[stringColumnKey]    = someValue;
ultraDataRow[ultraDataColumn]    = someValue;

ultraDataRow.SetCellValue( integerColumnIndex, someValue );
ultraDataRow.SetCellValue( stringColumnKey,    someValue );
ultraDataRow.SetCellValue( ultraDataColumn,    someValue );


According to the docs the 2-arg SetCellValue overload (above) does not raise cell update events.
Can somebody verify this?  Does the [] indexer approach raise cell update events?

Thank you!

  • 18495
    posted

    Hello,

    Did Brian's post answer your question?  If so, please verify it so other users with the same question can find the answer.

  • 69832
    Verified Answer
    Offline posted

    dnm240 said:
    Does calling ultraDataSource.SuspendBindingNotifications() have the same effect as calling ultraGrid.BeginUpdate() and SuspendRowSynchronization()?

    UltraGrid.BeginUpdate suspends painting, i.e., processing of WM_PAINT messages, which allows the grid to bypass things that it needs to do to keep the display in sync with the data. SuspendRowSynchronization prevents the  ActiveRow from being synchronized with the current record, and also prevents the rows from being synchronized with the associated data source. UltraDataSource.SuspendBindingNotifications switches off the firing of the IBindingList.ListChanged event, which as far as it applies to rows, is the same as suspending row synchronization. Strictly speaking, it also switches off notifications that result from things like the addition or removal of columns. I can't imagine it hurting your application to use both if you want to.

    dnm240 said:
    Does the [] indexer approach raise cell update events?

    No, it looks like it calls into the SetCellValue method passing false for the 'raise events' flag. Those lines of code are all essentially identical.