Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
504
UltratreeNode image not updated when property is modified
posted

Hello,

I am building a tree from a background worker, so that the user sees the tree build up "live". For nodes that are not completely filled, I want to temporarily change their default image for a "loading" image. When a node gets all its child nodes, its image is reset to default.

Here is my code :

 

// initialize node

node.Override.NodeAppearance.Image = index;

...

// now child nodes are to be added : change image to "loading"

node.Override.NodeAppearance.Image = (Image)Properties.Resources.ResourceManager.GetObject("loading"));

treeView.Refresh();

...

// tree loaded : reset initial image index

node.Override.NodeAppearance.Image = index;

 

However, this does not work : all nodes keep their initial image. Even with the tree refresh I cannot see my "loading" picture.

Thank you for your help !

Parents
  • 69832
    Offline posted

    It is difficult to speculate without additional details. One thing to note is that you cannot update the tree's images (or anything else for that matter) from the BackgroundWorker's DoWork event, so if you are doing it there that would explain the problem. Documentation for the BackgroundWorker class explains how the properly implement this kind of thing.

    If you are confident that you are handling the multithreading aspect of this correctly, and you are able, attach a sample project here and we can take a look.

Reply Children