BreadCrumbNode.BeginUpdate() Method
Locks the object and prevents any visual updates until the EndUpdate
method is called.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Remarks
The BeginUpdate
and EndUpdate
methods allow you to avoid flickering while performing batch modifications to the object’s settings.
Once the BeginUpdate
method is called, modifying the object’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 desired operations have finished, call the EndUpdate
method.
The BeginUpdate
and EndUpdate
methods use an internal counter to implement the update functionality. The counter’s initial value is 0.
Visual updates are disabled if the counter’s value is greater than 0, and the updates are enabled if the counter’s value is 0.
The BeginUpdate
method increments the counter. The EndUpdate
method decrements the counter. If the counter’s new value is 0, an immediate visual update occurs.
Each call to BeginUpdate
must be paired with a call to EndUpdate
. To ensure that EndUpdate
is always called even if an exception occurs, use the try...finally
statement.
public void UpdateNode(BreadCrumbNode node) {
try {
node.BeginUpdate();
// Update operations
}
catch { }
finally {
node.EndUpdate(); // The EndUpdate method is always reachable
}
}