Silverlight training, note to self: adding non-default Assemblies for additional controls

Problem: In my Silverlight training class, we were instructed to try using a TabControl in a newspaper Silverlight app. I followed part of the instructions to add the Assembly as an xmlns reference in the page code, but I couldn’t get the sucker to compile.

Here’s the line of code I added to the page:

xmlns:my=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls”

It was giving me this error:

The type or namespace name ‘TabControl’ does not exist in the namespace ‘System.Windows.Controls’ (are you missing an assembly reference?)

Solution: (Big forehead slap) Every single time I try to get back into .NET code, I keep having to learn this ridiculously, embarrassingly simple lesson: for whatever reason, when I add a reference to a .NET assembly in my code, I also have to add a reference to the References tree in the Solution Explorer:

  • In the Solution Explorer, browse to the Project where this code is failing
  • Right-click the References folder, choose Add Reference, and add System.Windows.Controls from the .NET tab

Silverlight training, note to self: blank page

Problem: Every time I try to debug a new project that’s derived from training materials, I end up with a blank page.

When I “View Source” on the debugging page, all I see is this:

Solution: need to set the default page in the Web project:

  • In Solution Explorer, browse the Project suffixed with “.Web”
  • Right-click on the .aspx page you wish to launch by default, and choose “Set As Start Page”