ADD EVENT HANDLER TO SILVERLIGHT XAML CODE PROJECT

In the previous section, a simple SWE application UI is created in XAML code using Expression Blend 3 and ported to a native code application as a subproject to a Compact 7 OS design. The exercise in this section adds an event handler to this application for the button click event.

Continuing with the SWE application project created in the previous section, work through the following steps to modify the Silverlight XAML code application to add an event handler for the button control:

1. Launch Express Blend 3, and open the XAML_Hello SWE application project created earlier in this chapter.

2. From the Expression Blend View menu, select Active Document View, and click Split view to show both the Design and XAML views.

3. From the Design view window, click the Button control.

4. From the Properties panel’s top-right corner, click the Events icon to list all available events associated with the Button control, as shown in Figure 22-13.

5. Enter button as the name for the control.

6. Double-click on the blank text box for the Click event to add a button_Click event. As you double-click on the Click event, the code editor window displays the MainPage.xaml.cs file, showing the code for the button_Click event, as shown in Figure 22-14.

7. From the File menu, click Save All to save the changes.

Get Professional Windows® Embedded Compact 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.