Set root operator initally to 'OR' logical operator

5 posts, 1 answers
  1. Daniela
    Daniela avatar
    21 posts
    Member since:
    Jun 2012

    Posted 09 Nov 2012 Link to this post

    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.
  2. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 09 Nov 2012 Link to this post

    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.

  3. DevCraft banner
  4. Answer
    Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 12 Nov 2012 Link to this post

    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.

  5. Daniela
    Daniela avatar
    21 posts
    Member since:
    Jun 2012

    Posted 12 Nov 2012 Link to this post

    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"/>
  6. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 15 Nov 2012 Link to this post

    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.

Back to Top
DevCraft banner