1

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.

1 Answer 1

5

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.