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

Where is the "root" CompositeFilterDescription?

2 Answers 99 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 26 Mar 2013, 01:49 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 26 Mar 2013, 04:34 PM
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.

0
Josh
Top achievements
Rank 1
answered on 26 Mar 2013, 04:42 PM
Great, thank you for the quick response!
Tags
DataFilter
Asked by
Josh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Josh
Top achievements
Rank 1
Share this question
or