How to add custom controls in WinForms TreeViewAdv?
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.
C#
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;
VB.Net
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
'To add custom control to child node
Me.treeViewAdv1.Nodes(2).Nodes(0).CustomControl = Me.comboBoxAdv2
Take a moment to peruse the WinForms TreeViewAdv - CustomControls documentation, to learn more about custom controls with examples.
Conclusion
I hope you enjoyed learning about how to add custom controls in WinForms TreeViewAdv.
You can refer to our WinForms TreeViewAdv feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms TreeViewAdv example 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!