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

Problems with RadTreeView

10 Answers 206 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 23 Jun 2008, 09:24 AM
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.

10 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 24 Jun 2008, 09:07 AM
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
0
hwsoderlund
Top achievements
Rank 1
answered on 24 Jun 2008, 01:38 PM
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?
0
Valentin.Stoychev
Telerik team
answered on 24 Jun 2008, 02:02 PM
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
0
hwsoderlund
Top achievements
Rank 1
answered on 24 Jun 2008, 02:13 PM
Sounds good, thank you.
0
Josef Rogovsky
Top achievements
Rank 2
answered on 01 Sep 2009, 12:20 PM
Is there an update on this issue?
0
Valentin.Stoychev
Telerik team
answered on 02 Sep 2009, 05:54 AM
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.
0
Kabs Hussain
Top achievements
Rank 1
answered on 06 Nov 2009, 01:21 PM
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.
0
hwsoderlund
Top achievements
Rank 1
answered on 06 Nov 2009, 01:39 PM
Maybe you are confusing SelectedItems and CheckedItems? They are two different things. If you clear the CheckedItems, nothing will happen to the SelectedItems.
/Henrik
0
Kabs Hussain
Top achievements
Rank 1
answered on 06 Nov 2009, 01:43 PM
Hi,
   Thanks for the reply.
  I am using a Checked items only as it is the Multiselect Treeview.
0
Miroslav
Telerik team
answered on 13 Nov 2009, 08:18 AM
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.
Tags
General Discussions
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
hwsoderlund
Top achievements
Rank 1
Josef Rogovsky
Top achievements
Rank 2
Kabs Hussain
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or