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
11 Answers, 1 is accepted
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.

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
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.

- 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.

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
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.

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
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.

- Lutz
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.