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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set a TreeNodeAdv as non-editable and non-selectable in WinForms TreeViewAdv?

Platform: WinForms |
Control: TreeViewAdv

Editing the node

To set the TreeNodeAdv as non-editable, handle the TreeViewAdv’s BeforeEdit & BeforeSelect events and set the Cancel property to True.


// Suppose the target node is the first node
private void treeViewAdv1_BeforeEdit(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs e)
   if(e.Node == this.treeViewAdv1.Nodes[0])
      e.Cancel = true;
//Non selectable
private void treeViewAdv1_BeforeSelect(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableSelectionEventArgs args)
   if(args.SelectedNodes[0] == this.treeViewAdv1.Nodes[0])
      args.Cancel = true;


' Suppose the target node is the first node
' NonEditable
Private Sub treeViewAdv1_BeforeEdit(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs)
   If e.Node = Me.treeViewAdv1.Nodes(0) Then
      e.Cancel = True
   End If
End Sub
'Non selectable
Private Sub treeViewAdv1_BeforeSelect(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableSelectionEventArgs)
   If args.SelectedNodes(0) = Me.treeViewAdv1.Nodes(0) Then
      args.Cancel = True
   End If
End Sub

Reference link: https://help.syncfusion.com/windowsforms/treeview/treenodeadvcustomization#editing-the-node

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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