Silverlight Attached Properties for WPF Developers

Hello fellow WPF geeks,

I stumbled upon an issue in Silverlight 2 Beta 1 with Attached properties. Yes, Silverlight does have Attached properties, but if you are coming from a WPF background than it might be useful for you to know that you MUST include the assembly=myAssemblyName in the xmlns that defines the namespace where your attached property lives. And YES even if the attached property lives in the same assembly as your XAML.

If you don’t you’ll get the following error

Additional information: AG_E_PARSER_PROPERTY_NOT_FOUND

So instead of creating the xmlns like this

xmlns:local="clr-namespace:SLAttachedProperties"

you should do this

xmlns:local="clr-namespace:SLAttachedProperties;assembly=SLAttachedProperties"

Yea, I guess it is a bug, after all it still in BETA 🙂

Have loads of fun and a nice weekend.