Reputation: 91
Hey collective brain,
So I need to add some additional click behavior to an existing button of a control whose click event, i assume, is handled somewhere in its encapsulated code. So I am using AddHandler() on the button, which is a CalendarDayButton, I can't seem to find a handler for click event. For the first argument of the AddHandler, I used ButtonBase.ClickEvent, and for the second I just used new EventHandler(button_click), and the third is "true". And then I get the "Handler type is mismatched." exception. Any input on this would be highly appreciated.
Upvotes: 1
Views: 2403
Reputation: 564851
The problem is that, in WPF, ButtonBase.Click is a RoutedEventHandler. You need to add an appropriate delegate (not EventHandler
, but one that implements RoutedEventHandler
).
Upvotes: 5