Firstly, what are they?
I say they are custom events that you can place into the tree in WPF to add extra functionality without subclassing controls.
The pure MSDN definition is:
“An attached event allows you to attach a handler for a particular event to some child element rather than to the parent that actually defines the event, even though neither the object potentially raising the event nor the destination handling instance define or otherwise ‘own’ that event in their namespace.”
However, you do have to read that quite a few times!
So I’ve broken it down into a few key elements:
- It is a normal WPF routed event
- They are custom events that mean you don’t have to subclass existing classes
- It is not a language event (with += & -= handlers in c#), you use AddHandler and RemoveHandler instead
- You can put them into attributes like standard system events
Hope that’s clear 🙂