Problems with RadTreeView

11 posts, 0 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 23 Jun 2008 Link to this post

    I can't seem to get the ExpandAll() method to work. I'm calling the method in the RadTreeView.Loaded event handler. Should I call it elsewhere?

    I also noticed that the Checked event only fires for child nodes if the children have already been expanded once. Example: I have a tree where the root node is "World" and the children are "Europe", "Africa" etc. When I check the World node immediately after the page has loaded the Checked event is only fired for that particular node, and not for the children. If I then expand the tree all children appear checked. If I then uncheck all nodes, collapse the tree and check the World node again, everything works as expected and the event fires for all the children.
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 24 Jun 2008 Link to this post

    Hello Henrik,

    Yes - this is a known issue with the ExpandAll method. Actually it is related with your second question.

    A little background first:

    Since the Beta2 release of the Silverlight2 platform there is a UI virtualization in the Silverlight runtime. It is a very simple concept and is borrowed from WPF - the elements that has Visibility set to "Collapsed" in the visual tree are not created before they are displayed - e.g. their Visibility property is set to "Visible".

    This should explain the behaviour that you are experiencing with the Checked event - the events are not fired because there are not RadTreeViewItem objects created until the nodes are expanded.

    For the next version we are thinking to fire those events once the nested items are expaded/created. Will this work for you?


    Greetings,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
  4. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 24 Jun 2008 Link to this post

    Hmm, I'm afraid that will not work. I need the tree to automatically check child nodes.  So when the root node is checked I need the entire node collection to be checked so that I can populate a List with the IDs of the selected nodes. I can hardly expect the user to manually expand all the nodes to get the expected behaviour. But maybe I'm missing something here...

    What I need is basically this:
    All my nodes should be plain vanilla checkboxes. No node selection, no mouseover effects or anything like that (possibly a tooltip for the text part of the checkboxes). When the tree is loaded initially I need to restore its state from IsolatedStorage (I want the user to be able to save his/her favourite state of the tree, including what nodes are checked, what nodes are expanded/collapsed etc.) If I cannot access the nodes before they're expanded I can't really see how any of the above would be possible. Do you have any suggestions?
  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 24 Jun 2008 Link to this post

    Hello Henrik,

    I see where the problem is.

    Yes - we know that this will cause a lot of confusion, so we are searching for a way to give you a simple solution for such scenarios. But for the moment we do not have one. We will investigate this with a high priority because it is a very common case.

    For the moment we have a some workarounds but they are too complicated and it is better not to use them. The basic idea behind all of them is to feed the TreeView with prepared TreeViewItems. In this case you will be able to achieve your scenario.

    We will follow up on this thread within the next couple of days after we research what options we have.

    Thanks again for your valuable feedback!

    Sincerely yours,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 24 Jun 2008 Link to this post

    Sounds good, thank you.
  7. Josef Rogovsky
    Josef Rogovsky avatar
    144 posts
    Member since:
    Sep 2012

    Posted 01 Sep 2009 Link to this post

    Is there an update on this issue?
  8. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 02 Sep 2009 Link to this post

    Hi Josef,

    We improved some of the methods of the TreeView to work asynchronously and to workaround the issues caused by the ui virtualization. What is the exact problem you are after?

    All the best,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Kabs Hussain
    Kabs Hussain avatar
    5 posts
    Member since:
    Nov 2009

    Posted 06 Nov 2009 Link to this post

    Hi,
      I am using a RadTreeview. My requirement is to uncheck all the nodes which are selected.
    I could not find any function.I tried using   tvMyTreeview.CheckedItems.Clear(); to uncheck all the selected items.
    But does not work.

    Need help.
    Thanks in advance.
  10. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 06 Nov 2009 Link to this post

    Maybe you are confusing SelectedItems and CheckedItems? They are two different things. If you clear the CheckedItems, nothing will happen to the SelectedItems.
    /Henrik
  11. Kabs Hussain
    Kabs Hussain avatar
    5 posts
    Member since:
    Nov 2009

    Posted 06 Nov 2009 Link to this post

    Hi,
       Thanks for the reply.
      I am using a Checked items only as it is the Multiselect Treeview.
  12. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 13 Nov 2009 Link to this post

    Hi Kabs Hussain,

    If you are not using virtualization, you can try deselecting the containers of the SelectedItems:

    foreach (var item in RadTree.SelectedItems)
    {
        var container = RadTree.ContainerFromItemRecursive(item);
        if (container != null)
        {
            container.CheckState == System.Windows.Automation.ToggleState.Off;
        }
    }

    If the you are using virtualization I can suggest binding the CheckState property of the TreeViewItem to one of the properties of your ViewModel by using ContainerBindings. This will be easier than making sure containers exist in order to uncheck them.

    Currently modifying the CheckedItems collection does not change the CheckedState of the items, i.e. it can only be used to enumerate the checked items. We are planning to improve this, but unfortunately I am not sure if we will manage to include it in SP1.

    Regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft banner