ChartCollectionBase.EndUpdate() Method
Unlocks the collection after a call to the ChartCollectionBase.BeginUpdate method and causes an immediate update.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
Declaration
Remarks
The ChartCollectionBase.BeginUpdate and EndUpdate methods are intended to be used to implement batch modifications. This allows you to prevent excessive updates when performing multiple modifications with chart element collections at the same time. To do this, enclose the code that makes the changes within calls to these methods.
The BeginUpdate and EndUpdate methods use an internal counter to implement their functionality. The counter’s initial value is 0. A call to the BeginUpdate method increments this counter by one. A call to the EndUpdate method decrements this counter by one and if its new value is zero, a change notification is generated. This means that each call to BeginUpdate must be paired with a call to EndUpdate. If a call to BeginUpdate is made but without a corresponding call to EndUpdate afterwards or EndUpdate is not called because an exception occurred, the View will no longer respond to changes. To ensure that EndUpdate is always called even if an exception occurs, wrap any calls to these methods in a try…finally statement.
Note
If you want to apply all the changes made since the BeginUpdate method was last called, and no notification events are to be raised, then the ChartCollectionBase.CancelUpdate method should be used.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the EndUpdate() 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.