Select Node with custom Equality

5 posts, 0 answers
  1. Adriaan
    Adriaan avatar
    8 posts
    Member since:
    Jun 2011

    Posted 30 Aug 2012 Link to this post

    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?
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Sep 2012 Link to this post

    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.

  3. DevCraft banner
  4. Adriaan
    Adriaan avatar
    8 posts
    Member since:
    Jun 2011

    Posted 05 Sep 2012 Link to this post

    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.
  5. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 06 Sep 2012 Link to this post

    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.

  6. Adriaan
    Adriaan avatar
    8 posts
    Member since:
    Jun 2011

    Posted 06 Sep 2012 Link to this post

    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 
Back to Top
DevCraft banner