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.
Unfortunately, activation email could not send to your email. Please try again.

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

 

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

C#

// Suppose the target node is the first node

//NonEditable

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;

}

VB

' 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

Article ID: Published Date: Last Revised Date: Platform: Control:
1234 04/30/2011 07/10/2014 Windows Forms TreeViewAdv
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.