How to scroll to particular TreeNodeAdv programmatically in WinForms TreeViewAdv?
Selection node
In the WinForms TreeView, to scroll a particular TreeNodeAdv or to ensure that it is visible programmatically, you can use the functions BringIntoView and EnsureVisible.
C#
//Shows the parent node of the selected node. this.treeViewAdv1.SelectedNode.Parent.BringIntoView(); //Shows the particular node. this.treeViewAdv1.Nodes[0].Nodes[this.treeViewAdv1.Nodes[0].Nodes.Count - 1].BringIntoView(); //EnsureVisible function also used to show the parent node of the selected node. this.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent);
VB
'Shows the parent node of the selected node. Me.treeViewAdv1.SelectedNode.Parent.BringIntoView() 'Shows the particular node. Me.treeViewAdv1.Nodes(0).Nodes(Me.treeViewAdv1.Nodes(0).Nodes.Count - 1).BringIntoView() 'EnsureVisible function also used to show the parent node of the selected node Me.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent) 'EnsureVisible function also used to show the particular node Me.treeViewAdv1.EnsureVisible(Me.treeViewAdv1.Nodes(0).Nodes(treeViewAdv1.Nodes(0).Nodes.Count - 1))
Samples:
Reference link: https://help.syncfusion.com/windowsforms/treeview/treenodeadvcustomization#nodeselection
Conclusion
I hope you enjoyed learning about how to scroll to particular TreeNodeAdv programmatically in WinForms TreeViewAdv.
You can refer to our WinForms TreeView’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms TreeView documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridListControl and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!