Silverlight UserControl Type Not Defined Exception


I have had a really frustrating day and a half trying to get a Silverlight UserControl to work in another project of mine. The solution consists of an ASP.NET website with domainservices made available to a number of Silverlight applications. The Silverlight UserControl was properly namespaced, inline with all the other projects. But could I add it to my Silverlight applications. NO!

I knew it had to be something to do with namespace issues, and I tried all sorts. In the end I managed to solve the issue with the help of my senior colleague.

The solution was as follows.

Here are the original namespaces of the web host project, and the UserControl respectively:

  • Lucid.Online.Assessments.Server (the web host)
  • Lucid.Controls.Silverlight.BlockButton (the user control)

Here are the modified namespaces:

  • LucidOnline.Assessments.Server (the web host)
  • Lucid.Controls.Silverlight.BlockButton (the user control)

Just one period caused all that hassle! Why? I don’t understand why. But at least this has fixed my issue.

So if you get the Type ” undefined exception, just check your namespaces.

Advertisements