NotificationCollection<T>.IsUpdateLocked Property
Gets whether the collection has been locked for updating.
Namespace: DevExpress.Utils
Assembly: DevExpress.Data.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
Boolean | true if the collection is locked; otherwise, false. |
Remarks
Once the BeginUpdate method has been called, modifying the NotificationCollection<T>‘s settings does not result in immediate repainting. So, multiple modifications can be made to the object without a major impact on performance or screen flickering. After all the desired operations have been finished, call the EndUpdate or CancelUpdate method. Use the EndUpdate method if the object needs to be immediately repainted after the changes have been applied. If the object’s visual settings haven’t been affected by the operations performed and the object should not be immediately updated, call the CancelUpdate method.
The BeginUpdate, EndUpdate and CancelUpdate methods use an internal counter to implement the update functionality. The counter’s initial value is 0. The BeginUpdate method increments the counter. The EndUpdate and CancelUpdate decrement the counter.
The object’s visual updates (change notifications) are forbidden if the counter’s value is greater than 0, and the updates are enabled if the counter’s value is 0.
Each call to BeginUpdate must be paired with a call to EndUpdate or CancelUpdate. To ensure that EndUpdate/CancelUpdate is always called even if an exception occurs, use the try…finally statement.
The NotificationCollection<T>.BeginUpdate and NotificationCollection<T>.EndUpdate methods use an internal counter to implement the required functionality. If the counter’s value is 0 (zero), the IsUpdateLocked is false.
The counter’s initial value is 0. Each call of the BeginUpdate method increments the counter, each call of the EndUpdate decrements the counter and if its new value is zero, change notifications are enabled. Use the IsUpdateLocked property to determine the collection state.