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

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: