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

Selection Bug

3 Answers 125 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 25 Mar 2010, 09:39 AM
Hello,

we have a problem using the tree view, when the control is databound to a list with duplicate objects (the object occurs in tree node X and tree node Y). The problem is, that the selection automatically switches to the first occurrence of the object whatever item of the object you click.

I attached the code of a demo-project, which shows this behaviour. With the standard WPF-tree everything is working.

For your information: we are not using the latest version of Rad Controls. An update to the newest version is not possible for us due to compatibility issues.

Thanks in advance for the support.
Matthias

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 31 Mar 2010, 07:27 AM
Hi Matthias,

We are aware of this behavior and it is expected.

You are correct about the Microsoft treeview. But things are different here - our treeview is much more complex control and is entirely data driven. It is possible to support and this scenario, but it will involve a lot of code to be written in order to support this specific scenario.
 
The main difference between the WPF treeview and Telerik treeview is that ours can handle millions of records because of the use of virtualization - which means that we do not rely on the containers to keep the state of the items, because the containers are recycled all the time and can not keep any state. You will get the same effect when using the WPF listbox control which is also virtualized.

For the moment we can only suggest you not to use the same instance of your business object twice in the bound collection, we do not have plans to support this scenario.

Regards,
Valentin.Stoychev
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.
0
Mathew Murphy
Top achievements
Rank 1
answered on 28 Jun 2010, 05:42 AM
This would be a feature I would like to see in the control. A pretty common use case for a tree is to group things by category and to assume that each object would only appear in one category is fairly limiting. I need to refactor from a scenario where an item only occurs once in the tree to one where it can appear multiple times under different nodes...
I don't see how it can be much effort to implement internally in the control - you can get the RadTreeViewItem the user clicks on easy enough - it is already visible thus virtualisation is not an issue in that case. If you needed to select an item via code then a unique path on the objects should be all you need. If it isn't supported directly via the control the only options I can come up with are -
1) Hack around the issue by getting the item the user clicked on PreviewMouseDown (MouseLeftButtonDown must get handled by the treeview) and then force a reselection at the RadTreeViewItem level.
2) Create wrapper objects to bind to which would require much more refactoring.

Please consider implementing this feature it would make life easier.


*update: looking at the Q1 2010 version of the treeview the PreviewSelectionChanged is a great addition and could possibly help me here. Is there any way to 'Select Item by path'. There is an ExpandItemByPath, a SelectItemByPath would be useful also. I can use the IsSelected property on the node but managing this at the node level is messy. Thanks.
0
Valentin.Stoychev
Telerik team
answered on 01 Jul 2010, 12:28 PM
Hi Mathew Murphy,

Thank you for this suggestion. We will implement SelectItemByPath right after the official Q2 release.

Sincerely yours,
Valentin.Stoychev
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
Tags
TreeView
Asked by
Matthias
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Mathew Murphy
Top achievements
Rank 1
Share this question
or