Filter items in a RadTreeView

4 posts, 1 answers
  1. Jay
    Jay avatar
    6 posts
    Member since:
    Oct 2011

    Posted 02 Aug 2012 Link to this post

    I want to filter the items displayed in a RadTreeView based on the value of a property set on each item.  I'd like to have the tree view reflect the current state of its items whenever this property is changed.  Is this possible?

    This is what I've tried so far but I don't know enough about how QueryableCollectionView and FilterDescriptors work to know that I'm using it properly.
    public class Node
        public string Name { get; set; }
        public bool IsVisible { get; set; }
        public Node(string name, bool isVisible)
            this.Name = name;
            this.IsVisible = isVisible;

    ObservableCollection<Node> nodes = new ObservableCollection<Node>();
    QueryableCollectionView items = new QueryableCollectionView(nodes);
         new FilterDescriptor(
             "IsVisible", FilterOperator.IsEqualTo, true, false, typeof(bool)
  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 07 Aug 2012 Link to this post

    Hello Jay,

    The QueryableCollectionView is just a view over the original collection. This means that if you define a filter in the QueryableCollectionView, it will represent the filtered version of the original collection. So in your case you can set the items collection as the ItemsSource of the RadTreeView. This way it will display the filtered collection. However, as soon as you change the value of the IsVisible property of any item, you'll need to refresh the QueryableCollectionView to reflect the changes and to create a new view of the original collection based on the new settings of the IsVisible property. I attached a sample solution demonstrating this approach.

    You can also have a look at this demo solution demonstrating how to filter, sort or search through the RadTreeView ItemsSource collection.

    Let me know if that info helps or if I can further assist you.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. naman
    naman avatar
    1 posts
    Member since:
    Oct 2015

    Posted 16 Sep Link to this post


    even I am facing the same problem.

    Here IntemSource of radtreeview is a Collection of custom objects, the icon value is taken from the object itself

    I am filtering the collection using predicate and getting the filtered values in FilteredCollection.

    after reassigning tree is getting filtered but icons are getting disappeared.

    ObservableCollection<Object> objectCollection= FilteredCollection;
    radTree.ItemsSource = objectCollection;

    the same code is getting executed by constructor and that is working fine but after reapplying the filter it is loosing all the icons.

  5. Dinko
    Dinko avatar
    182 posts

    Posted 21 Sep Link to this post

    Hi naman,

    Let us start with that this thread is several years old and we prefer to keep separate questions in separate threads because it is easier to follow a conversation - easier for us to answer your questions and easier for you to find our answers. We will ask that you open a new thread for this. Thank you for understanding.

    As for your question, we weren't able to reproduce the behavior using only the provided information. Because of this, we would like to ask you for a sample project so that we could examine your scenario directly on our side. Any additional information which you think could help us to better understand your approach will be of great help.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top