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

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

4 Answers 96 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Parul
Top achievements
Rank 1
Parul asked on 01 Mar 2011, 06:50 AM
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 !!!!

4 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 03 Mar 2011, 06:44 PM
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!
0
Tina Stancheva
Telerik team
answered on 04 Mar 2011, 10:43 AM
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!
0
gans
Top achievements
Rank 1
answered on 17 Feb 2012, 04:15 AM
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. 
0
Petar Mladenov
Telerik team
answered on 21 Feb 2012, 05:10 PM
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 >>
Tags
TreeView
Asked by
Parul
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
gans
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or