Nicke Manarin
Nicke Manarin

Reputation: 3358

Preventing image on TreeView root node, and preventing selected node from defaulting to image 0

I have a TreeView with a ImageList populated in run time. This TreeView has only a root node and everything else is a direct child of that root node.

I have 2 problems:

1) My root node have a image, and I don't want.

//I tried to put -1, because this property has a default 0 (non-nullable int)
this.Nodes[0].ImageIndex = -1;
//But nothing happened.

2) The selected node always change the image to the index 0, it shouldn't

//Again, changing to -1 did nothing.
this.SelectedImageIndex = -1;

Example:

enter image description here

Upvotes: 2

Views: 1568

Answers (1)

Aelphaeis
Aelphaeis

Reputation: 2613

Get a blank .ico file (You can use this one :http://knowledgebase.twocoders.de/wp-content/uploads/2010/10/blank.ico) and add it to your image list. Set the image to the index of the blank.ico. The end result should will be a list view node without an icon. Here is an example of what it looks like:

This is a picture

Upvotes: 1

Related Questions