#190 – Adding an Event Handler to a Control Using Blend

You’ll generally use Visual Studio to create and edit event handling code for a WPF application.  But you can also add event handling code using Blend.

To add an event handler using Blend, start by left-clicking to select the control for which you want to add an event (e.g. a Button).

Now, click on the Events icon on the Properties tab to see a list of the control’s events.

Next, find the event for which you want to add an event handler and double-click in the empty area next to the event name.  The event name will be filled in and you’ll be taken to the code editor for the new handler.

If you go back to look at the XAML, you’ll also see the new event handler defined there.