XPBaseCollection.SuspendChangedEvents() Method
Prevents the immediate update of the collection when objects are added/removed and filtering/sorting is changed until the XPBaseCollection.ResumeChangedEvents method is called.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Remarks
Each time the collection is changed (e.g., a new object has been added), the XPBaseCollection.CollectionChanged event is raised. This forces a control to which the collection is bound to repaint itself. This may slow down the application’s performance or result in flickering when performing several changes. To avoid this, the code performing multiple changes must be enclosed within the SuspendChangedEvents and XPBaseCollection.ResumeChangedEvents method calls.
The SuspendChangedEvents method prevents the XPBaseCollection.CollectionChanged event from firing and suppresses automatic updates of the object list and the XPBaseCollection.Count value when the collection filter or sorting is changed until the XPBaseCollection.ResumeChangedEvents method is called. Any changes made after a call to the SuspendChangedEvents method will not force the bound control to update itself. The XPBaseCollection.ResumeChangedEvents method raises the XPBaseCollection.CollectionChanged event, so that the bound control can redraw itself. Any further changes are applied immediately.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SuspendChangedEvents() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.