Shawn Oster (gravatar)

Adding Silverlight Toolkit Controls to the Visual Studio and Blend Toolbox

Now that title is a mouth-full.  I’ve seen a few questions in the Silverlight.net forums asking how to get the Silverlight Toolkit controls into the toolbox/asset library of Visual Studio 2008 and/or Expression Blend 2.  There are a bunch of great posts scattered among the tubes on how to do this but I wanted to explain both Visual Studio 2008 and Blend 2 in one post.  Plus it’ll segue nicely into an upcoming post :)

Download the Silverlight Toolkit

  1. Download the latest release of the Silverlight Toolkit (December 2008 as of this post).
  2. Unzip to a folder of your liking (I use the highly imaginative C:\Source\Silverlight Toolkit December 2008).

Adding to the Visual Studio 2008 Toolbox

You can add the controls to any tab in the Toolbox you like, for this example I'm going to create a new tab, Silverlight Toolkit.

  1. Right-click anywhere in the Toolbox and select Add Tab, name it Silverlight Toolkit.
  2. Right-click in the empty space of the Silverlight Toolkit group and select Choose Items.
  3. Select the Silverlight Components tab.
  4. Click Browse and browse to \Binaries folder, adding Microsoft.Windows.Controls, Microsoft.Windows.Controls.Input and Microsoft.Windows.Controls.DataVisualization.
  5. The controls will now appear in your Toolbox.

    Silverlight Toolkit controls in Visual Studio 2008 toolbox

Adding to Expression Blend 2 Asset Library

Adding controls to Blend is even easier, though you do have to repeat this process for each new project.  Also because making controls available in Blend requires you to add references to your project, thus increasing your download size, you should only add references to the assemblies you need.  Bit of a chicken and egg issue.  To help you decide which assemblies to add I included a breakdown of which controls are in what assembly after these instructions.

  1. In your Project pane right-click on References, select Add Reference….
  2. Add references to Microsoft.Windows.Controls, Microsoft.Windows.Controls.DataVisualization, Microsoft.Windows.Controls.Input.

    Blend 2 Project Pane

  3. The controls will now appear in the Custom Controls section of the Asset Library.

    Blend 2 Asset Library

What’s In Each Assembly?

Microsoft.Windows.Controls

  • AutoCompleteBox
  • DockPanel
  • Expander
  • HeaderedContentControl
  • HeaderedItemsControls
  • Label
  • TreeView
  • TreeViewItem
  • Viewbox
  • WrapPanel

Microsoft.Windows.Controls.Input

  • ButtonSpinner
  • NumericUpDown

Microsoft.Windows.Controls.DataVisualization

  • Charting (with associated Axis, DataPoint and Series).

Getting Support, Offering Feedback

As always the best place to get support for the Silverlight Toolkit is to post in our forum on Silverlight.net.  If you have a feature request or bug please file it in our Issue Tracker and get some votes behind it.  We look carefully at those numbers when we decide how to prioritize the bug fixes.

(Updated to include warning about adding assemblies you don’t need in Blend and what controls are in each assembly, plus fixed the title tag on a few images)

9 Comments

  • Won't adding references to the toolkit in Blend force them to be compiled into the final xap of your app and therefore increasing final size?
    Or will the compiler automatically not include any unused assemblies?

    I'm just thinking for example if you included all of the toolkit libraries but then didn't use any of the controls from the DataVisualization assembly.

  • @Mike - Yes it will, that's a good thing to mention. It becomes a chicken & egg issue, you want to see what controls are available yet to see that you have to first add them directly to your project.

    To avoid that I'd suggest people first learn what controls are in each assembly. In fact I'll update the blog post to reflect your comments.

  • Stephen (gravatar)

    Stephen said
    February 06, 2009

    Mike,

    Hi. Although I'm thankful for the instructions, I can't believe even test product is delivered without an install readme. Developers (new and seasoned salts) should not have to google blogs to get such information. I don't think that anyone expects a finished installer, but instructions such as yours need to be positioned immediately next to the download link or in the readme. Again, thanks for the clear instructions.

  • Nate (gravatar)

    Nate said
    March 01, 2009

    I downloaded this, and I'm trying to add components, but I don't have the "Silverlight Components" tab.
    I have Visual Studio 2008.
    Any help would be appreciated.

  • Marcus Baffa (gravatar)

    Marcus Baffa said
    March 05, 2009

    Hi Shawn,

    I have just included the references os Silverlight Toolkit, in Blend, but the controls did not appear in the Asset Library.

    I ams working with Blend 2 SP1 and I have just downloaded the Silverlight Toolkit. Is there any known issue about this ???

    Thanks

  • Lisseth (gravatar)

    Lisseth said
    March 09, 2009

    I did all the that the post said and get this error:

    Error al cargar tipos desde el emsamblado Microsift.Windows.Controls.DataVisualization.dll No se puede cargar el archivo o emsamblado
    'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' ni una
    de sus dependencias. El sistema no puede hallar el archivo espicificado.

    Thanks for you help.

  • mbs (gravatar)

    mbs said
    May 28, 2009

    Regarding adding the toolkit to Blend, where exactly are these libraries that one should add? When i right click and select 'add references', i am greated wit the file selection dialogue. Not sure if i need find the libraies in /windows/system32, somwhere under the .net3.5 install or in the GAC.

  • vijay (gravatar)

    vijay said
    June 17, 2009



    I cant able to get all the Silverlight Toolkit dlls as a single zip file as we get when we download a Ajax controll tool kit ,, Where can i get such Zip file,, pls help

  • You can download installers from the CodePlex page (http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=20430). We switched from .zip files to installers to make it easier for people just starting to know where to put the files plus after install the controls are available in your toolbox without any manual steps on your part.

    Is there a reason you'd prefer zips over msi?

Your Information
Mrs. Gravatar (gravatar)

<-- It's a gravatar

your comment