In order to subscribe to a routed event, the event handler code needs to match the expected method signature. This tutorial looks a sample signatures for WPF events.
- [Instructor] At some point, when you're working…with Events, you'll want to create an Event Subscriber.…To do that, you'll create what's known as an Event Handler,…which is just a method, that has a certain Event Signature.…And, that's what I'm talking about, in this video.…For some of you, this will be familiar territory.…If you've worked in .NET, everything I'm showing you,…in this video, is similar to the way…Events work elsewhere, in .NET.…For this example, I'm working with…a class, that has an Event.…The class is called the Dispatcher Timer,…shown on line 25, and, in WPF, you use…the Dispatcher Timer, to notify code, when a Timer expires.…
So, I'll set an interval, every time that interval…expires the Dispatcher Timer will raise an Event,…and, then, my code can react to that.…So, what I've done, on Line 25,…is instantiate the Dispatcher Timer.…On line 26, I set the interval to one second.…On line 27, I start the Timer.…On line 28, I will set up the Event Handler.…The name of the Event, is Tick.…And, currently, it's not pointing to any delegate.…
- Understanding routed events and event signatures
- Wiring up event handlers
- Event bubbling and tunneling
- Programming mouse events
- Programming keyboard and ink events