GanttControl.EndUpdate() Method
Allows the framework to redraw the control after the BeginUpdate method is called. Redraws the control immediately.
Namespace: DevExpress.XtraGantt
Assembly: DevExpress.XtraGantt.v24.1.dll
NuGet Package: DevExpress.Win.Gantt
Declaration
Remarks
After BeginUpdate is called, the framework cannot redraw the control on-screen. You can call this method before you make multiple changes at a time (add multiple items to a collection, customize multiple appearance settings, etc.). This prevents the control from being redrawn after each change and improves performance.
When changes are made, call the CancelUpdate or EndUpdate method. These methods allow the framework to redraw the control. The EndUpdate method also forces the framework to redraw the control immediately. To ensure that the CancelUpdate or EndUpdate method is called even if an exception is thrown, use the try…finally statement.
The BeginUpdate method also disables automatic scheduling — dependent tasks are not re-scheduled when a task is changed (see ScheduleMode).
Example
The code below defers all project tasks for one month.
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList.Nodes.Operations;
ganttControl1.BeginUpdate();
try {
ganttControl1.NodesIterator.DoOperation(new MyOperation());
}
finally {
ganttControl1.EndUpdate();
}
public class MyOperation : TreeListOperation {
public override void Execute(TreeListNode node) {
node.SetValue("StartDate", ((DateTime)node.GetValue("StartDate")).AddMonths(1));
}
}