How to change icons of node tree in the DocumentExplorer

How to change the default icons of nodes (node tree ) in the DocumentExplorer and use custom icon(s)?

1 Reply

NG Naganathan Ganesh Babu Syncfusion Team March 26, 2018 09:19 AM UTC

Hi Allen, 
 
We suggest you to use DocumentExplorer’s “ImageList” collection property to add the new image into the list and then use TreeNode’s “SelectedImageIndex” and “ImageIndex” properties to set the index of the newly added image from the ImageList as per your requirement. 
 
Please refer to the below code example. 
 
Code example: 
 
[VB] 
 
'change default icons for the nodes 
Dim bmpimg As New Bitmap("..//..//image1.jpg") 
documentExplorer1.ImageList.Images.Add(bmpimg) 
'Change icon while selecting the particular node 
documentExplorer1.Nodes(0).Nodes(0).Nodes(0).SelectedImageIndex = documentExplorer1.ImageList.Images.Count - 1 
'Change icon for the particular node 
documentExplorer1.Nodes(0).Nodes(0).Nodes(0).ImageIndex = documentExplorer1.ImageList.Images.Count - 1 
 
Regards, 
 
Naganathan K G 


Loader.
Up arrow icon