
Your Q1 2016 example references the "MyFilterDescriptorBindingBehavior" in the "Example.xaml" file of the "DataFilter.Default Filter Editors" example. However, that is nowhere to be found.
I need to add a FilterDescriptor using code that is displayed in the control for the user to interact with. This seems like the example that would cover the scenario but the documentation is incomplete. Can you help me with this?
Joel
10 Answers, 1 is accepted
Thank you for reporting this issue. I have checked the situation and indeed we have missed adding the implementation of this specific class. You can find it in the code for the "Data Filter Custom Editors" demo. We will update the demo in the near future so that it has all the information needed. Please, check if this implementation suits your project needs and update me if you need any assistance.
Of course, if you have any further questions or concerns, do not hesitate to contact us as well.
Regards,
Stefan Nenchev
Telerik

I get an Object reference error when attempting to get this working with that Behavior. Can you compile a simple project for me? I'd appreciate it,
Joel
I have created a sample project based on the Default Filter Editors demo and have attached it to my reply. Please update me if it is running as expected.
Regards,
Stefan Nenchev
Telerik

So, my original objective is to be able to add FilterDescriptors during run time. Problem is, this is a "StaticResource". Is there a way to do this with a binding to a "DynamicResource" or better yet, as part of a property with an "IObservableCollection" approach.
You can add different FIlterDescriptors to the StaticResource during run-time by utilizing the Commands mechanism in order to not break the MVVM approach. I have updated the project I have previously provided you with so that you can add a certain FilterDescriptor during run-time and it is working as expected. Can you please review it and update me if it would suit your needs?
If you insist on using a dynamic resource, you can achieve the effect by inheriting the DataFilter control and registering an additional DependencyProperty.
Regards,
Stefan Nenchev
Telerik

Thank you very much for your attention to this. This had me stumped.
I'll give it a try,
Joel

I'm having an issue with your sample code. If I add or remove a filter descriptor via the RadDataFilter, MyModel.FilterDescriptors does not get updated, nor does MyFilterDescriptorBindingBehavior.CollectionChanged get called. However, once I click on "Add Filter Descriptor" then MyFilterDescriptorBindingBehavior.CollectionChanged gets called and MyModel.FilterDescriptors gets updated each time I add or remove a filter descriptor via the RadDataFilter. I was hoping that MyModel.FilterDescriptors would get updated everytime I add or remove a filter descriptor via the RadDataFilter. Any ideas of how to do this? Thanks.
This behavior is indeed a bit strange. My best guess is that it is due to some timing issue. Though I cannot confirm the exact cause for it, a possible approach to overcome it would be to subscribe to the CollecitonChanged event of the FilterDescriptors collection of RadDataFilter and update the underlying collection based on it.
Would such an approach be feasible for you?
Regards,
Stefan
Progress Telerik

Hi Stefan,
I was able to modified the behavior such that my underlying collection gets updated each time a FIlterDescriptor gets added or removed. I use the behavior "as is" to populate the RadDataFilter FilterDescriptors from my underlying collection. Then in dataFilter_Loaded, I unsubscribe to the datafilter collection changed event, and subscribe to the FilterDescriptors collection changed event, and in its event handler, I modify the underlying collection to reflect changes in the RadDataFilter's FilterDescriptors. Thanks.
Thank you for the update.
I am pleased to hear that you have managed to achieve the desired result.
Feel free to contact us again should you need any other assistance with our components.
Regards,
Stefan
Progress Telerik