Import a custom control by adding a reference

This page applies to Silverlight 2 projects only

As a designer, you might receive an assembly file (DLL) that contains a custom control that you have to use in your project. Or, you might want to use the controls that are available in the Silverlight 2 Software Development Kit (SDK) in your project. To be able to draw these kinds of controls on the artboard, you must first add a reference to the assembly.

To draw a custom control on the artboard

  1. On the Project menu, click Add Reference (ALT+SHIFT+R).

  2. In the Add Reference dialog box, browse to the DLL file that contains the custom control, and then click Open.

    In the Project panel, under References, the DLL file appears in the list of default project references.



    To be able to use the controls that come with the Silverlight 2 SDL, add a reference to the correct assembly located in the C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client folder. For example, to draw a TabControl, add a reference to the System.Windows.Controls.dll assembly.

  3. Build your project (CTRL+SHIFT+B) to incorporate the classes from the DLL into your project.

  4. Open a XAML file on the artboard (such as Page.xaml) by double-clicking the name of the file in the Projects panel.

  5. Click the Asset Library Dd185501.0224cabd-5da1-4e01-bddd-4a647401a098(en-us,Expression.10).png button in the Toolbox.

  6. In the Asset Library, select the Custom Controls tab, and then select your new control.



    The controls that come with the Silverlight 2 SDK are listed in the Controls tab.

    Your new control appears above the Asset Library button in the Toolbox as the selected tool.

  7. Using your mouse, draw the custom control on the artboard.

    The control appears on the artboard and under Objects and Timeline.


  8. Test your project (F5) to see the new control.


    You can add a reference to an uncompiled project by first adding the project to your solution and then adding the project reference to the first project. This is useful if you want to work on both projects at the same time in the same Expression Blend window. For more information, see Add a new or existing project to a solution.


  • If you cannot see the custom control displayed in the Custom Controls tab of the Asset Library, try to build the project before you open the Asset Library again.

  • After you draw your new control on the artboard, if it appears clipped, it might be because the control has default layout properties that are incompatible with the size of the control when you first drew it. With the new control selected under Objects and Timeline, reset the Margin properties to 0 under Layout in the Properties panel, and then try to resize the control again.

See also


Add a new or existing project to a solution