)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add custom controls in WinForms TreeViewAdv?

Platform: WinForms |
Control: TreeViewAdv |
Published Date: April 21, 2015 |
Last Revised Date: February 5, 2020

Custom controls

In 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

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: https://help.syncfusion.com/windowsforms/treeview/treenodeadvcustomization#custom-controls

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon