Filtering using FilterDescriptor opens All the Nodes

2 posts, 0 answers
  1. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 18 Jun 2013 Link to this post

    I have a problem where after applying the Filter, it opens up all the nodes. 

    I am using FilterDescriptor.

    We have a Huge Tree and we don't want the Tree and its children  to open after applying the Filter. Any idea how to stop it from opening after applying the Filter?

    I am not able to attach the project, but will attach the screen shot. 

    Here is code snippet. 

    private void RadContextMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show Spain"))
                {
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "Spain";
                    this.RadTreeListView1.FilterDescriptors.Add(descriptor);
                }
     
                CompositeFilterDescriptor mainFilter = new CompositeFilterDescriptor();
     
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show England"))
                {
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "England";
                    mainFilter.FilterDescriptors.Add(descriptor);
                    this.RadTreeListView1.FilterDescriptors.Add(mainFilter);
                }
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show England - France"))
                {
                    mainFilter = new CompositeFilterDescriptor();
                    mainFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "England";
     
                    mainFilter.FilterDescriptors.Add(descriptor);
                    descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "France";
     
                    mainFilter.FilterDescriptors.Add(descriptor);
     
                    this.RadTreeListView1.FilterDescriptors.Add(mainFilter);
                }
     
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Clear Filter"))
                {
                    this.RadTreeListView1.FilterDescriptors.RemoveAt(0);
                }
                 
            }

  2. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 21 Jun 2013 Link to this post

    Hello,

    We have already answered to the forum thread you started on the same topic.

    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top