Source properties displayed

12 posts, 0 answers
  1. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 17 Mar 2014 Link to this post

    I'm using RadDataFilter in Bound mode.
    I have a bunch of objects in the Source list that I'd like to filter that are of different types. They're all derived from a base class. The dropdown in the filter only shows the properties in the base class. Is there a way to make the dropdown show all properties that have a [Display] attribute on them, even though they are in different derived classes?

    For example, if I derive class Manager from your Employee class and add a new property bool HasCar to Manager with the [Display] attribute, I'd like that property to also be available for filtering. Any non-employees (objects that don't have that property) should be ignored (i.e. always culled out). Is this possible? Or do I need to go to Unbound mode and write all the filtering code myself?

    - Lutz
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 20 Mar 2014 Link to this post

    Hello Lutz,

    Please take a look at this forum thread for a reference: "Data Filter and Inheritance".


    Regards,
    Maya
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 20 Mar 2014 in reply to Maya Link to this post

    Thanks Maya, that is what I suspected.

    So I will need to switch to unbound mode and implement the filtering code myself.... Is there any sample that shows how to evaluate the FilterDescriptors?

    - Lutz
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Mar 2014 Link to this post

    Hi Lutz,

    You can check the RadDataFilter Unbound Mode article as an example.

    Regards,
    Didie
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  6. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 24 Mar 2014 in reply to Dimitrina Link to this post

    No, that article in no way explains how to do that. All it shows is how to transfer the FilterDescriptors to the GridView, which then does the filtering. I am not using a GridView, however, so I need to evaluate the filters myself, but I can't find any sample code that demonstrates how to evaluate the descriptors.....

    - Lutz
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Mar 2014 Link to this post

    Hello Lutz,

    In order to evaluate the filters directly through the RadDataFilter, you will have to add or remove the filters from RadDataFilter.FilterDescriptors collection. 

    Regards,
    Didie
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  8. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 26 Mar 2014 in reply to Dimitrina Link to this post

    Ummm, what? Either you aren't really reading what I'm writing and asking, or I'm really bad at explaining myself....

    I have a RadDataFilter in my app that will allow users to create a filtering query.
    I do NOT have a RadGridView.
    I have a list of objects (different types in a class hierarchy) that need to be filtered.
    I have to use Unbound mode because of the class hierarchy.
    When it's time to do the filtering, I have to figure out whether a specific instance satisfies the filter query or not.
    The filter query is in the form of the FilterDescriptors list.
    I now need to iterate over the FilterDescriptors and figure out whether my specific instance satisfies the filter.
    Is there sample code for that?

    - Lutz
  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Mar 2014 Link to this post

    Hello,

    You say you have a list of objects and you do not have a RadGridView. Where do you populate the data you would like to filter? As I understand you would like to filter it from this control.

    Does the suggestion and the the demo code sent by my colleague in the other forum thread you have opened on how to filter in unbound mode not work for you?

    In order to avoid any further misunderstanding, may I ask you to send me a demo solution with your specific setup? 

    Regards,
    Didie
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  10. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 27 Mar 2014 in reply to Dimitrina Link to this post

    I have a custom control (3D visualizer) that uses a databound list of objects that I was hoping to filter with RadDataFilter.

    The demo code from your colleague on the other thread is the same as in the Telerik Browser and does not do what I need. It simply transfers FilterDescriptors from the RadDataFilter to the RadGridView. I'm guessing that the RadGridView knows how to evaluate the FilterDescriptors against its list of objects. However that is obviously not a viable solution for my custom control, since it does not know how to interpret the FilterDescriptors.

    I have written a lot of code that iterates over and recurses into the FilterDescriptors in an attempt to evaluate the FilterDescriptors, but it's not done and it looks like it is going to be way too much work.

    If you made the evaluation engine of the Filters more transparent I might have been able to hook into it somewhere....

    I will try to come up with a sample when time permits.

    - Lutz
  11. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Apr 2014 Link to this post

    Hello Lutz,

    You will need to have your source collection interpreting the FilterDescriptors. Unfortunately RadDataFilter cannot control this. As your control does not expose FilterDescriptors itself, I can suggest you wrapping the source collection in such a proper collection. For example you can consider the QueryableCollectionView.
    For example:
    MyViewModel model = new MyViewModel();
    QueryableCollectionView vvv = new QueryableCollectionView(model.Clubs);

    Then use this instance as a source for your control. That way you can work with this collection and its FilterDescriptors collection.

    How does this work for you?

    Regards,
    Didie
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  12. Lutz
    Lutz avatar
    19 posts
    Member since:
    Jun 2012

    Posted 01 Apr 2014 in reply to Dimitrina Link to this post

    As I understand it, your filters do not work with an object class hierarchy, reverting to the lowest common base class for the list of properties to allow filtering on. I don't think that using a QueryableCollectionView will change that since your underlying filter implementation won't be able to process my different class instances. Which is why I'm trying to interpret the FilterDescriptors manually.

    - Lutz
  13. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Apr 2014 Link to this post

    Hi,

    It is not mandatory that the ItemsControl has FilterDescriptors collection itself. You will operate through the bound source collection ("vvv") in this case.
    Having the filtering criteria defined with RadDataFilter, you should ensure your source collection is filtered out. If it does not support FilterDescriptors itself, you will have to ensure this manually (as per the capabilities of the particular collection).

    Regards,
    Didie
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready