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

Select Node with custom Equality

4 Answers 63 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Adriaan
Top achievements
Rank 1
Adriaan asked on 30 Aug 2012, 08:06 AM
Hi,

After much reading I can select TreeViewItem from code behind, JustinAngel's Extension methods works great for me, but now I need to use custom equality logic, any idea how I can find a TreeViewItem with custom equality logic?

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 04 Sep 2012, 07:33 AM
Hello Adriaan ,

I guess we will need some additional information in order to advice you correctly.
What exactly do you need to achieve with the RadTreeView? It already has ItemContainerGenerator property and you can use its ContainerFromIndex, ContainerFromItem, ContainerFromItemRecursive methods.
On the other hand, you are able to access a particular RadTreeViewItem with the GetItemByPath method described in this article.
You mentioned that you need a custom equality logic. Are you actually trying to avoid a known selection issue in the RadTreeView - please check out this item ?

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Adriaan
Top achievements
Rank 1
answered on 05 Sep 2012, 05:09 AM
Hi Petar,



Thanks for the response.



What I was hoping for is an IEqualityComparer<T> in the methods like ContainerFromItem, I use wrapper classes and would like equality to be based on one of the attributes of the data context of Node. This is also inline with most of the Linq statements like Distinct etc.
0
Hristo
Telerik team
answered on 06 Sep 2012, 06:32 AM
Hi Adriaan,

You could override the equals method in your view models in order to override the default comparison logic provided by the framework.

Please let us know if we have missed some details around your scenario and the proposed solution is not applicable.

Greetings,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Adriaan
Top achievements
Rank 1
answered on 06 Sep 2012, 08:57 AM
Overriding equality wont work for me as I mostly use generic wrapper classes and often have different equality conditions for them, would also prefer to stay with the pattern Linq uses 
Tags
TreeView
Asked by
Adriaan
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Adriaan
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or