Generic Routed Event Handler 1.0

The idea is pretty simple: EventHandler<T> for routed events.

public static readonly WellThatHappened = EventManager.RegisterEvent("WellThatHappened", 
        RoutedEventStrategy.Bubble, typeof(RoutedEventHandler<MyRoutedEventArgs>), typeof(MyClass));

Wow, that's a long line. Draw your attention to the third parameter, typeof(RoutedEventHandler<MyRoutedEventArgs>). You'll want to use this approach if you need to use a custom event args class, like we did here. It's really that simple.

Last edited Jan 24, 2009 at 5:43 AM by flanakin, version 2

Comments

No comments yet.