FilterDescriptors to Predicate

2 posts, 0 answers
  1. Roland
    Roland avatar
    10 posts
    Member since:
    Jul 2011

    Posted 15 Aug 2011 Link to this post


    What is the easiest way to turn my RadDataFilter's FilterDescriptors into a Predicate<object>? 

    I noticed that the RadDataFilter.FilteredSource has a property called Filter (of type Predicate<object>). I want to have something similar but the classes used are marked internal. Note that I have the DataFilter in unbound mode, hence the ItemsSource and FilteredSource properties are null.

  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 18 Aug 2011 Link to this post

    Hi Roland,

    The FilterDescriptor<T> allows you to directly plug a predicate that determines which items are filtered. You just need to set a lambda to the FilteringExpression property like so:

    var descriptor = new FilterDescriptor<Employee> { FilteringExpression = e => prospects.Contains(e) };

    where 'prospects' is a collection of Employees.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top