This is a migrated thread and some comments may be shown as answers.

Images not updated until scrolling

2 Answers 85 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 13 Feb 2013, 10:05 AM
I'm adding all my nodes in the NodesNeeded event. Then, in the NodeFormatting event, I'm changing the image of the nodes using the ImageKey.

The problem is that NodeFormatting is not called for all visible nodes. It seems it gets called for arbitrary root nodes when I expand one of the roots or when I scroll up and down. What's going on?

UPDATE
If I explicitly set the ImageKey when adding the nodes (which I don't want to do), then all images are updated when I click inside the tree view. Calling Refresh() after adding the nodes does not help.

UPDATE 2
Another problem...
when I double-click node A its icon changes to "Open" and is kept open until I select one of its child nodes. When a child is selected, the icon changes to "Closed". I have put breakpoints at all places where I set the icon to "Closed" and it does not fire. Hence, for some reason, the RadTreeView manages to revert the icon to its previous state...

2 Answers, 1 is accepted

Sort by
0
Kristoffer
Top achievements
Rank 1
answered on 13 Feb 2013, 10:37 AM
Ok, I found the problem. I added my image list in my form's Load event handler. That seems to be too late. Moving it to the constructor solved the problem.

And, I would argue that this piece of information should be present in your documentation.
0
Jack
Telerik team
answered on 18 Feb 2013, 06:53 AM
Hi Kristoffer, 

I am glad to hear that the issue is solved now. Please note that the NodeFormatting event fires when binding RadTreeView. This event will fire after the binding process finishes only when scrolling or expanding nodes.

Do not hesitate to contact us if you have other questions.
 
Greetings,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
Treeview
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Kristoffer
Top achievements
Rank 1
Jack
Telerik team
Share this question
or