I'm not sure if I understood the question correctly, but I will give him a chance:
How to check if any event handlers are attached to the TestEvent event:
TestEvent will be null if event handlers are not bound.
If one handler is attached (one-click delegate) _invocationList == 0 :
Paste the following expression into the QuickWatch expression string:
((System.Reflection.RuntimeMethodInfo)(((System.Delegate)(TestEvent))._methodBase)).Name
to find out which event handler is connected.
If more than one handler is connected (multicast delegate) _invocationList > 0 :
You need to look at _invocationList , for example, to check the first attached method:
((System.Reflection.RuntimeMethodInfo)(((System.Delegate)(((object[])(((System.MulticastDelegate)(TestEvent))._invocationList))[0]))._methodBase)).Name
Check other attached handlers: change the index to 1, 2, etc. or just expand each element of the _invocationList array.
As an alternative to using the Name property, which is just the name of the handler method, you can use the m_toString field, which is the signature of the method.
In all examples, replacing TestEvent with the name of your event.
[Edit] I did not understand that you are using WPF. The WPF event system is much more complicated.
Let's say you have a button and what to check if any handler is attached to the MouseLeftButtonDown event:
- Open QuickWhatch.
- Insert the name of the button variable (say
button1 ). - Scroll through the base classes until you get a
UIElement . Or quickly insert this ((System.Windows.UIElement)(button1)).EventHandlersStore into the expression. - Find and deploy the
EventHandlersStore property. - Expand
_entries . - Expand
_mapStore . - Expand
[MS.Utility....] - You will see a list of
_entry0 , _entry1 , ... _entry_n . Each of them is all events that the button also assigns to handlers. - To find out which handlers are assigned, expand the specific
_listStore => _listStore . - You will again see the list
_entry0 , _entry1 .... These are all the handlers associated with this particular event.

source share