Attached Event Routing on Custom Class

Jan 6, 2011 at 8:18 AM
Edited Jan 6, 2011 at 8:25 AM

Hi There,

I am having trouble with the following code:

RoutedMessaging:Message.Attach="[AttachedEvent MyNamespace.MyClass.MyAttachedEvent] =[Action DoAction($eventArgs)]"

 

The XAML class is in a different assembly to "MyClass". When when XAML is run, I get an error Cannot Find Type "MyNamespace.MyClass".

 

I have tried:

a) Making sure MyClass is in the same assembly as the XAML file

b) Registering MyClass in my IOC container

c) Adding MyClass to the same namespace as the view, and referencing it as "[AttachedEvent MyClass.MyAttachedEvent]...."

 

None of these worked

 

As a test, i tried hooking up to the TextBoxBase.TextChanged attached event - this worked fine.

I am using Caliburn (full) v 2.0.0.0

Any suggestions?

Thanks

Michael

Jan 6, 2011 at 8:49 AM

Nevermind, I just realised the problem. MyClass was not a DependencyObject.

Silly. Sorry for the bother.

Doh.