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

Set root operator initally to 'OR' logical operator

4 Answers 52 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Daniela
Top achievements
Rank 1
Daniela asked on 09 Nov 2012, 12:08 PM
Hi!
Im looking for a way to set the root operator to initially 'OR'. Is there a way to achieve this.
I tried setting:
public MainPage()
       {
           _mainViewModel = new MainViewModel();
           this.DataContext = _mainViewModel;
 
           InitializeComponent();
           this.dataFilteQuery.FilterDescriptors.LogicalOperator = Telerik.Windows.Data.FilterCompositionLogicalOperator.Or;
 
       }
 the Logical Operator of the FilterDescriptor after initialization of the components. But the operator stays as 'AND' when the page is loaded.

4 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 09 Nov 2012, 04:18 PM
Hi Daniela,

You can change the logical operator between the two field filters, like so:

countryFilter.FieldFilter.LogicalOperator = Telerik.Windows.Data.FilterCompositionLogicalOperator.Or;

 I suggest you to check this help article, where you can find detailed information about programmatic filtering. 

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Accepted
Yoan
Telerik team
answered on 12 Nov 2012, 08:44 AM
Hello Daniela,

 
Please excuse me for misleading you. In my previous post I had shown you how to set the logical operator for RadGridView.

Indeed, the logical operator of RadDataFilter has to be set as you tried. For your convenience I have prepared a sample project. Please find it attached for a reference.


All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Daniela
Top achievements
Rank 1
answered on 12 Nov 2012, 12:25 PM
Hello Yoan,
thank you for your quick reply.

The problem was, that I set the source of the filter (binded to my ViewModel) in the xaml instead the code behind (see attached code). This was the only change between your and my code. I wonder why this made the trick...?

Thanks again,
Daniela


<telerik:RadDataFilter x:Name="dataFilteQuery"
Margin="5 5 20 0"      
Source="{Binding SearchResults}"
BorderThickness="0"
VerticalAlignment="Stretch"
EditorTemplateSelector="{StaticResource EditorTemplateSelector}"
EditorCreated="dataFilterQuery_EditorCreated"
MinWidth="600"/>
0
Yoan
Telerik team
answered on 15 Nov 2012, 10:37 AM
Hi Daniela,

 Indeed, it is working as expected. You can check the attached project. As you can see, I set DataFilter's source in the XAML. 

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataFilter
Asked by
Daniela
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Daniela
Top achievements
Rank 1
Share this question
or