This is a migrated thread and some comments may be shown as answers.

Listening to filter changes in bound mode

3 Answers 80 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Benjamin Piepiora
Top achievements
Rank 1
Benjamin Piepiora asked on 27 Aug 2010, 01:43 PM
Hello,

I want to update a graphic control which uses the content of a RadDataGrid which is filtered by a RadDataFilter.
Is there a way to listen to changes when the RadDataFilter Control is in bound mode? I tried to listen to FilterDescriptors.CollectionChanged and to RadDataGrid.Filtered but it doesn't seem to work.

Regards,
Benjamin

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 30 Aug 2010, 08:54 AM
Hi Benjamin Piepiora,

We tried to reproduce this behavior based on your description, but unfortunately we could not.

Can you please open a separate support ticket and attach a sample project that demonstrates the way it does not work. We will then examine it and see what is going wrong.

Thanks in advance. We are looking forward to hearing from you.

All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Benjamin Piepiora
Top achievements
Rank 1
answered on 31 Aug 2010, 10:59 AM
Hello Ross,

I searched a bit and found out that the error appears when you surround the RadDataFilter Control with a RadBusyIndicator. I created a support ticket (ID 343771) and attached a sample project.

Regards,
Benjamin
0
Rossen Hristov
Telerik team
answered on 31 Aug 2010, 01:24 PM
Hi Benjamin Piepiora,

Let me try to explain what is going on. The BusyIndicator is not directly responsible for this behavior.

The FilterDescriptors property of RadDataFilter is a DependencyProperty. Each time a new source is set, it is replaced. In other words, it is not the same collection instance throughout the lifetime of the control. When RadDataFilter is created, it uses an internal dummy class as its Source. This is the so called Unbound Mode. This internal dummy class provides the FilterDescriptors instance that is assigned to the property. Later on, when the real Source arrives, a new FilterDescriptors instance is assigned to this same property. So the one you are listening for is not longer there. It is a new one. Here is the flow of events:

1. RadDataFilter is created. By default it enters Unbound Mode and creates an empty FilterDescriptors collection.
2. You attach your event handler to this collection.
3. The Source property is set.
4. RadDataFilter wraps the source collection in a DataItemCollection (IQueryableCollectionView) and assigns its FilterDescriptors to the FilterDescriptors property of RadDataFilters.
5. So basically, all the changes happen in this new collection, while you are still listening to the old one.

Since FilterDescriptors is a DependencyProperty, you should bind to it. Then when a change occurs, you will know. You will detach the event handler from the old one and attach them to the new one. In this way, you will be sure that you are always listening to the correct collection of FilterDescriptors even is the Source changes run-time.

I hope this helps. Let me know if it does not.

All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DataFilter
Asked by
Benjamin Piepiora
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Benjamin Piepiora
Top achievements
Rank 1
Share this question
or