views:

1490

answers:

5

I have a WPF form and I am working with databinding. I get the events raised from INotifyPropertyChanged, but I want to see how to get a list of what items are listening, which i fire up the connected handler.

How can I do this?

+1  A: 

What do you mean with the Items that are listening ?

Do you want to know which controls are databound to your property , or do you want to have a list of eventhandlers that are wired to the PropertyChanged event ?

The latter can be done by calling GetInvocationList on the event.

Frederik Gheysels
A: 

I'm looking for the controls bound on the other side - ie what should change once the event has been handled. I'll take a look at the above - thanks.

simonjpascoe
A: 

Call GetInvocationList() on your event instance. U'll get an array of delegates (if any): Delegate[]. For each delegate u can inspect the Method property - to get the MethodInfo of the method that acts as the listener; or the Target property - to get the instance of the object on witch the listener method is defined

AZ
A: 

Thanks for the answers all, I managed to track it down to null references on a different property (quite a lucky find!)

simonjpascoe