Performance in Windows Forms TreeView

4 Feb 20222 minutes to read

WinForms TreeViewAdv performance can be improved by the following properties and methods.


In TreeViewAdv, while loading 20,000 nodes it took nearly 60 seconds to load. Make this delay as considerable time this property is enabled. When EnableVirtualization is set as true, the parent nodes are added by scrolling the vertical scrollbar and the child nodes are added when expanding the respected parent node


Improves performance of the TreeViewAdv with large number of nodes. Generally, the time taken to populate 5000 child nodes to a root node takes 10 milliseconds. But after setting the SuspendExpandRecalculate property to true, the time taken for populating is decreased to half of its original time i.e., 5 milliseconds. The unnecessary calling of Recalculate dimensions for the child nodes when the Root nodes are collapsed is also reduced.


By default, it is true. This property when set to false, greatly improves the performance of the tree nodes on load.

Property Table

TreeViewAdv Properties Description
EnableVirtualization Indicate whether virtualization support is enabled or not
SuspendExpandRecalculate Indicate whether the Recalculation of the Nodes maximum height should be done while expanding or collapsing
RecalculateExpansion Indicates if node dimension calculation should be done on load.

Methods Table

TreeViewAdv Methods Description
BeginUpdate Calling this method will stop the redraws of the control and makes the node addition more faster than normal.
EndUpdate Resumes the painting of the control suspended by BeginUpdate method.


While adding more than one node to the treeViewAdv control, calling the BeginUpdate and EndUpdate method will improve performance of the control.

this.treeViewAdv1.SuspendExpandRecalculate=true; this.treeViewAdv1.EnableVirtualization = true;
for (int i = 1; i <= 20000; i++)
        TreeNodeAdv treeNode = new TreeNodeAdv("Parent " + i);
Me.treeViewAdv1.EnableVirtualization = True

'add more number of nodes