Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BarItem.BeginUpdate() Method

In This Article

Locks the BarItem object by preventing visual updates until the EndUpdate method is called.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public virtual void BeginUpdate()

#Remarks

The BeginUpdate and EndUpdate methods allow you to avoid flickering while performing batch modifications to the BarItem‘s settings. Once the BeginUpdate method has been called, modifying the BarItem‘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 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 forbidden 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.

See Also