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
Advertisements

One thought on “Silverlight training, note to self: adding non-default Assemblies for additional controls

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s