Search code examples
c#wpfeventsrouted-eventssubscriber

C# - Get a list of subscribers listening to a RoutedEvent?


I'm trying to get a list of objects that are subscribing to the PasswordBox PasswordChanged event.

The PasswordBox has a static readonly RoutedEvent PasswordChangedEvent and an instance PasswordChanged event.

Thanks!


Solution

  • Perhaps you can look at this a different way.

    Register for the PasswordChanged event, modify the PasswordBox value, then verify your listener was called with the provided value.

    Since you have a reference to the control this will be much easier then attempting to acquire the list of subscribers external to the control.