Prev | Current Page 310 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

Row="0" HorizontalAlignment="Left"
Background="AliceBlue" BorderBrush="Black" BorderThickness="1"
MouseUp="SomethingClicked">

MouseUp="SomethingClicked">
Image and text label

MouseUp="SomethingClicked" />
MouseUp="SomethingClicked">
Courtesy of the StackPanel





Handle first event




Figure 6-1. A bubbled image click
CHAPTER 6 n DEPENDENCY PROPERTIES AND ROUTED EVENTS 159
THE HANDLES STATEMENT
This example uses XAML event attributes. However, it works equally well with the Handles statement. To use
this approach, you must first ensure that you add a name to every element that raises a MouseUp event that
you want to handle. You can then list all the events in one giant clause at the end of your event handler declaration,
as follows:
Private Sub SomethingClicked(ByVal sender As Object, _
ByVal e As RoutedEventArgs) _
Handles Me.MouseUp, Grid1.


Pages:
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322