2

The question says it all basically.

I want in a

class MyClass 

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

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
sirrocco
  • 7,975
  • 4
  • 59
  • 81

2 Answers2

1

Actually I wiredup the event the wrong way :|

I had

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

Instead of

EventManager.RegisterClassHandler ( typeof ( TheClassThatOwnedTheEvent )

So .. my bad.

sirrocco
  • 7,975
  • 4
  • 59
  • 81
0

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
  • 17,561
  • 2
  • 43
  • 74