Performance in Windows Forms MultiColumn TreeView

21 Jan 20251 minute to read

The performance of the MultiColumnTreeView can be improved by using the following properties and methods.

SuspendExpandRecalculate

When the SuspendExpandRecalculate property is set to true, the populating time nearly reduces to half of its original time by recalculating the nodes maximum height while expanding and collapsing.
The unnecessary calling of Recalculate dimensions for the child nodes when the Root nodes are collapsed is also reduced.

this.multiColumnTreeView1.SuspendExpandRecalculate = true;
Me.multiColumnTreeView1.SuspendExpandRecalculate = True

The below methods can be used to temporarily stop painting of nodes and new nodes can be added to the control in between these methods

MultiColumnTreeView Methods Description
BeginUpdate Calling this method will stop the redraws of the control and makes the node addition faster than normal.
EndUpdate Resumes the painting of the control suspended by BeginUpdate method.
this.multiColumnTreeView1.BeginUpdate();

//Add more node here

this.multiColumnTreeView1.EndUpdate();
Me.multiColumnTreeView1.BeginUpdate()

' Add more node here

Me.multiColumnTreeView1.EndUpdate()