How to search a RadTreeView which have XML DataBinding in WPF ?

5 posts, 0 answers
  1. Parul
    Parul avatar
    22 posts
    Member since:
    Dec 2010

    Posted 01 Mar 2011 Link to this post

    I am having a RadTreeView in my screen in which data is coming from XML datasource in wpf.

    I am using XmlDataProvider and HierarchicalDataTemplate for displaying the data.
    Now i have a search textbox above this RadTreeView which filters the nodes present in this RadTreeview.

    Kindly let me know the procedure which filters the nodes of my RadTreeView (parent and child both).

    Thanks !!!!
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 03 Mar 2011 Link to this post

    Hello Parul,

    We will need more time to prepare a solution for your scenario. I will get back to you tomorrow the latest.

    In the meantime you can examine this demo illustrating how to implement filtering in the RadTreeView for Silverlight. You can implement the same logic in WPF as well.

    Regards,
    Tina Stancheva
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 04 Mar 2011 Link to this post

    Hello Parul,

    Since you need to filter the RadTreeView ItemsSource collection, it is best to create data classes, which to wrap the XML data objects. This will allow you to filter the data class collections similarly to what the Filter/Search/Sort demo in Silverligth demonstrates.

    Also, you will need to create a temp collection, on which to apply the filters, while keeping the original so that you can set it back as RadTreeView ItemsSource when no filtering is applied.

    Please examine the attached solution and let us know if it works for you.

    Best wishes,
    Tina Stancheva
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 16 Feb 2012 Link to this post

    Hi Tina,

    Do you have an example that does the filtering like you did that can work for any level of Hierarchy?  I think the example would work only upto 2 level. 
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Feb 2012 Link to this post

    Hello Gans,

     Currently, we don;t have such example. Having the mentioned project in this thread as a base, you have to create a recursive function that filters the ViewModels hierarchy starting from the deepest levels and ending with the root levels.

    All the best,
    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready