Articles in this section
Category / Section

How to add custom controls in WinForms TreeViewAdv?

1 min read

Custom controls

In WinForms TreeviewAdv, you can add custom controls to its TreeNodeAdv by using TreeNodePrimitive class and CustomControl property. The following code example demonstrates the same.


Syncfusion.Windows.Forms.Tools.TreeNodePrimitive TreeNodePrimitive1 = new Syncfusion.Windows.Forms.Tools.TreeNodePrimitive();
TreeNodePrimitive1.Index = 0;
//To set the custom control as PrimitiveType
TreeNodePrimitive1.PrimitiveType = Syncfusion.Windows.Forms.Tools.PredefinedPrimitiveTypes.CustomControl;
//Add nodes primitives collection
TreeNodeAdv4.Primitives.AddRange(new Syncfusion.Windows.Forms.Tools.TreeNodePrimitive[] {TreeNodePrimitive1});
TreeNodeAdv4.ShowLine = true;
//To add custom control to child node   
this.treeViewAdv1.Nodes[2].Nodes[0].CustomControl = this.comboBoxAdv2;


Dim TreeNodePrimitive1 As Syncfusion.Windows.Forms.Tools.TreeNodePrimitive = New Syncfusion.Windows.Forms.Tools.TreeNodePrimitive()
TreeNodePrimitive1.Index = 0
'To set the custom control as PrimitiveType
TreeNodePrimitive1.PrimitiveType = Syncfusion.Windows.Forms.Tools.PredefinedPrimitiveTypes.CustomControl
'Add nodes primitives collection
TreeNodeAdv4.Primitives.AddRange(New Syncfusion.Windows.Forms.Tools.TreeNodePrimitive() {TreeNodePrimitive1})
TreeNodeAdv4.ShowLine = True
TreeNodeAdv4.Text = ""TreeNodeAdv3.Nodes.AddRange(New Syncfusion.Windows.Forms.Tools.TreeNodeAdv() {TreeNodeAdv4})
'To add custom control to child nodeMe.treeViewAdv1.Nodes(2).Nodes(0).CustomControl = Me.comboBoxAdv2

Reference link:  


I hope you enjoyed learning about how to add custom controls in WinForms TreeViewAdv.

You can refer to our WinForms TreeView feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied