tags:

views:

100

answers:

2

The question says it all basically.

I want in a

class MyClass

to listen to a routed event. Can it be done ?

A: 

If you can create an inner class of MyClass (call it MyInnerClass) that derives from FrameworkElement while retaining the capability to access an enclosing MyClass object, your problem will be solved. You can then implement a 'getListener' method within MyClass that returns the embedded MyInnerClass that you will use to actually listen to events.

tucuxi
+1  A: 

Actually I wiredup the event the wrong way :|

I had

EventManager.RegisterClassHandler ( typeof ( MyClass )......

Instead of

EventManager.RegisterClassHandler ( typeof ( TheClassThatOwnedTheEvent )

So .. my bad.

sirrocco