IEnumerable Datasource Error

2 posts, 0 answers
  1. Lee
    Lee avatar
    1 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    Hi,

    We're just implementing Telerik controls in our WPF (PRISM) application and having some problems with the DataFilter control.
    We have a radgrid and can bind the control to the grid and filter without any problems. However, the requirement is display 3 filterable fields when the screen loads and for only 3 fields out of a possible 8 of the grid view.

    So we're trying to go down the FilterDescriptions route and define our 3 filters programatically

                    var companyFilter = new FilterDescriptor("Receiver Company", FilterOperator.Contains, "", true);
                radDataFilter.FilterDescriptors.Add(companyFilter);
     
                var addressFilter = new FilterDescriptor("Address Line 1", FilterOperator.Contains, "", true);
                radDataFilter.FilterDescriptors.Add(addressFilter);
     
                //// DateTime filter.
                var dateFilter = new FilterDescriptor("Created Date", FilterOperator.IsGreaterThan,
                                                     new DateTime(2007, 5, 1));
                radDataFilter.FilterDescriptors.Add(dateFilter);

    However when we do this it throws an error saying the source isn't IEnumerable. The source in this instance is defined in the XAML as the radgrid, which has loaded an IList<Receiver> object, which last time I checked was IEnumerable.

    Even if I set the Datasource programatically to a List<Receiver> still get the same error.

    I'm not sure where to turn and thinking maybe Data annotations are an option.

    Any views?

    Thanks.


  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 17 Mar 2011 Link to this post

    Hello Lee,

    When you say that the member is called "Address Line 1", do you think that RadDataFilter can find what to filter on?

    I believe that you are confusing ItemPropertyDefinitions with FilterDescriptors.

    Greetings,

    Ross
    the Telerik team
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top