Delayed load time of child nodes

10 posts, 0 answers
  1. BECK
    BECK avatar
    15 posts
    Member since:
    Oct 2010

    Posted 23 Oct 2010 Link to this post

    Hey all, 

    I have a very simple radtreeview structure. I basically have 3 root nodes and each node has 3 children. Every time I expand the tree node, there's a delay loading the child nodes. The delay isn't huge but it's a very noticeable delay compared to the original TreeView control. I suspect this has to do with the way the node appears (the turn on looking way). Is there a way to change that behavior so it's identical to the Windows TreeView control ?

    Thanks

  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 24 Oct 2010 Link to this post

    Hello Beck,

    You can do a couple of things to reduce the delay:
    1. Set the ExpandAnimation property to None.
    2. Set LoadOnDemand to false (this should be the default value).

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  3. UI for WinForms is Visual Studio 2017 Ready
  4. BECK
    BECK avatar
    15 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    Thanks for the suggestions. They did help but I found out that the performance is significantly better if databinding is used as opposed to doing something like :
    TreeView1.Nodes.Add(New .. )

    I have another question about the RadTreeView (Winform); is there a way to style a node level for data bound RadTreeView control? In other words, because this is databound I would say something like any nodes in level 0 will have a forecolor of Blue. Is that possible?

    THanks
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 27 Oct 2010 Link to this post

    Hello again Beck,

    Yes, there is, and you can do it like so:
    private void ChangeForeColorOfRootNodes()
    {
        if (radTreeView1.Nodes.Count == 0)
        {
            return;
        }
     
        foreach (var rootNode in radTreeView1.Nodes)
        {
            rootNode.ForeColor = Color.Blue;
        }
    }

    If you are having problems using this method because the fact that the tree is not loaded before you call this method, you could try adding this line:
    Application.DoEvents();
    in the first line of the method.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  6. BECK
    BECK avatar
    15 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    Thank you for our reply. Applying styles to a nodes after the entire tree is populated is inefficient because I'm looping twice to do that. The first time is the loop to create the node (done by databinding in this case) and another to style the nodes. 

    I was basically looking for an event like "OnRadTreeNodeAdding" event that's fired when a node is added via data binding. In that case, I would actually be able to style the node at the same time the node is created and added. 

  7. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 28 Oct 2010 Link to this post

    Hello again Beck,

    Sorry, but for the treeview there are no such events.
    In my point of view it isn't that inefficient because whenever you are dealing with a tree structure you come to expect recursion in order to find a specific node, change something and so on.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Nov 2010 Link to this post

    Hi BECK, 

    There may be another way to do this. If I have it right what you want to do, you could try subscribing to the collection changed and collection changing events as described in this forum post

    Let me know if that helps
    Richard
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Nov 2010 Link to this post

    Hi guys

    Thank you all for writing.

    The suggestions that Richard and Emanuel provided are correct and you can use either one of them. The difference is that when this is done in the CollectionChanged event all newly added nodes will be styled, and if you use the for loop suggestion, you will not have this functionality.

    Let us know which way is more convenient for you if you find a difference in the loading time. Additionally, if you need further assistance, please share with us what is the size of the data that you are loading in RadTreeVIew or even better provide me with a sample project in a new support ticket.

     
    Best wishes,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. erwin
    erwin avatar
    358 posts
    Member since:
    Dec 2006

    Posted 04 Jan 2011 Link to this post

    Make sure you wrap your creation of child nodes code with BeginUpdate() / EndUpdate(). This speeds things up quite a bit.
  11. Kavita
    Kavita avatar
    1 posts
    Member since:
    Sep 2011

    Posted 02 Jan 2012 Link to this post

    Hi,
     
    I am using latest version of telerik.I want to put some delay while expanding the tree node.Can anyone please help me in this.
Back to Top
UI for WinForms is Visual Studio 2017 Ready