Event handlers for Preview events take precedence over event
handlers for ordinary events of the same type, so if you have set up, for example, an event handler
for a MouseUp event and an event handler for a PreviewMouseUp event for the same object, only
the event handler for the PreviewMouseUp event will be executed. For this reason, you probably
do not want to set up event handlers for any Preview events unless you use them to override an
already existing event.
Events are numerous, and their names are often self-explanatory. For a detailed description
of events, click the Events button at the top of the Properties panel, and move your
mouse over the name of any event and read the tooltip.
Creating an event handler to change an image in
the code-behind file
In Chapter 3, we discussed the steps for setting up event handlers and adding code to event handlers.
Here??™s another example, which we will describe in detail. Figure 20.2 shows a button that
has an image below it that changes to another image when you click on the button. To create a button
like this, first add both images to your project, choosing Project ??? Add Existing Item, and add
one of the images to the artboard by right-clicking on it in the Files palette and choosing Insert in
the pop-up menu that appears.
Pages:
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751