I need to add a nested filter to a Datafilter UI, but when I try:
RadFilter.FilterDescriptors.Add(new CompositeFilterDescriptor());
I get a "Cannot change ObservableCollection during a CollectionChanged or PropertyChanged event."
When the line is executed I am not iterating through any collection.
RadFilter.FilterDescriptors.Add(new CompositeFilterDescriptor());
I get a "Cannot change ObservableCollection during a CollectionChanged or PropertyChanged event."
When the line is executed I am not iterating through any collection.
4 Answers, 1 is accepted
0
Hello,
Didie
Telerik
May I ask you to please test with the latest internal build? Where do you try to add the nested filter? Is it on a button click or is it when an event is raised?
Didie
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Trevor
Top achievements
Rank 1
answered on 28 May 2013, 02:45 PM
I am intending to do this on a button click event. But I just tried it on a dispatchtimer's tick event and upgraded to 2013.1.403.1050 and had the same results. I can add regular filterdescriptors fine
0
Hi,
I hope this helps.
Regards,
Didie
Telerik
Thank you for clarifying.
It seems that you cannot add a new CompositeFitlerDescriptor like so. You have to initialize it first.
For example:
private
void
Button1_Click(
object
sender, RoutedEventArgs e)
{
CompositeFilterDescriptor compositeDescriptor =
new
CompositeFilterDescriptor();
compositeDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
compositeDescriptor.FilterDescriptors.Add(
new
FilterDescriptor());
compositeDescriptor.FilterDescriptors.Add(
new
FilterDescriptor());
RadFilter.FilterDescriptors.Add(compositeDescriptor);
}
I hope this helps.
Regards,
Didie
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Trevor
Top achievements
Rank 1
answered on 29 May 2013, 02:06 PM
Yes, thank you for the information. I arrived at the exact same conclusion and as ran the program to confirm it I got a ding on my phone that this reply had been posted =).
It seems you cannot populate the actual filter control with empty compositefilters. What I did was populate an observablecollection of compositefilters and filled them out there, then added the filled compositefilters to the Radfilter control.
It seems you cannot populate the actual filter control with empty compositefilters. What I did was populate an observablecollection of compositefilters and filled them out there, then added the filled compositefilters to the Radfilter control.