All routed events have a method signature that includes RoutedEventArgs parameter. This tutorial looks at sample RoutedEventArgs types and shows how to extract meaningful information from the parameter.
- [Instructor] In this movie, I want to look at how you pass…arguments into a event handler in WPF.…Specifically, I want to talk about one of the parameters…for an event handler, the RoutedEventArgs.…So a review, when you have an event inside a class…that has a delegate that indicates the signature…that the subscribe has to meet when they listen…for the event.…And that signature can be any valid .NET signature.…So you could have, like on line 26 here,…I could have, let's say I have a FrameworkElement…that has some mouse move, mouse down events.…
When I raise that event, I might say that you have to have…a method that has the first argument be a FrameworkElement.…That would be the sender of the event.…And then a number of arguments for the button states.…Mine is going to have multiple buttons, so I might have five…different parameters here.…And then I might have a parameter for the mouse device…and a parameter for the current location on the screen…for a mouse move event.…So when I'm writing my event handler,…
- Understanding routed events and event signatures
- Wiring up event handlers
- Event bubbling and tunneling
- Programming mouse events
- Programming keyboard and ink events