Xaml DelegateFilterDescriptor Filter binding

2 posts, 0 answers
  1. Alexei
    Alexei avatar
    2 posts
    Member since:
    Sep 2016

    Posted 17 Nov 2016 Link to this post

    Hi all,

    Need some help with binding.

    I have a page with following xaml:

     <Entry x:Name="ListFilter" />

    ....

    <dataControls:RadListView x:Name="ItemsList" ItemsSource ="{Binding ItemsList}" >

    ...

         <dataControls:RadListView.FilterDescriptors>
                  <listView:DelegateFilterDescriptor Filter="{Binding ....}"></listView:DelegateFilterDescriptor>
         </dataControls:RadListView.FilterDescriptors>

    ....

     

    How could I write a binding for Filter (DelegateFilterDescriptor's property) to execute the contains predicate in xaml with parameter Entry's Text property. Equivalent to code behind expression:

    ItemsList.FilterDescriptors.Add(new DelegateFilterDescriptor {Filter = (n)=>((Item)n).Name.Contains(ItemsList.Text)});

     

    Thank you in advance.

    Alexei

  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    574 posts

    Posted 22 Nov 2016 Link to this post

    Hello Alexei,

    Thank you for contacting us.

    This scenario is not supported. Adding a filter descriptor to the FilterDescriptors collection triggers the filtering once and any further changes in the descriptor are not regarded. You have to modify the FilterDescriptors collection to initiate new filtering. Generally, what you could do in this case is: clear the descriptors collection and add new descriptor every time the entry text is changed. I have attached an example.

    I hope this helps.

    Regards,
    Rosy Topchiyska
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top