Where is the "root" CompositeFilterDescription?

3 posts, 1 answers
  1. Josh
    Josh avatar
    4 posts
    Member since:
    Mar 2012

    Posted 26 Mar 2013 Link to this post

    Hello, I was wondering how to change and/or remove the "root" composite filter in the RadDataFilter. I am loading filters programmatically and I need to change the default "And" to an "Or". If this is not possible, than I just need to remove this root filter and add my own. Please see the code below as well as the attached screen shot. I am using .NET 4.0 (full) and Telerik 2013 Q1. Thank you.

    XAML:

    <T:RadDataFilter x:Name="filtMain" AutoGenerateItemPropertyDefinitions="False" />

    Code Behind:
    filtMain.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("FirstName", typeof(string), "First Name"));
    filtMain.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("MiddleName", typeof(string), "Middle Name"));
    filtMain.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("LastName", typeof(string), "Last Name"));
    CompositeFilterDescriptor parent = new CompositeFilterDescriptor() { LogicalOperator = FilterCompositionLogicalOperator.Or };
    parent.FilterDescriptors.Add(new FilterDescriptor("FirstName", FilterOperator.EndsWith, "an"));
    parent.FilterDescriptors.Add(new FilterDescriptor("MiddleName", FilterOperator.IsEqualTo, "Bob"));
    parent.FilterDescriptors.Add(new FilterDescriptor("LastName", FilterOperator.DoesNotContain, "Doe"));
    // FilterDescriptors is empty. Where is the root "And" composite that I see on the screen???
    filtMain.FilterDescriptors.Add(parent);

  2. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Mar 2013 Link to this post

    Hi,

    You could change the LogicalOperator like so:

    this.filtMain.FilterDescriptors.LogicalOperator = Telerik.Windows.Data.FilterCompositionLogicalOperator.Or;

      Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Josh
    Josh avatar
    4 posts
    Member since:
    Mar 2012

    Posted 26 Mar 2013 Link to this post

    Great, thank you for the quick response!
Back to Top