Condividi tramite


Draw a user control in another document

After you create a user control, build the project to make the user control appear in the Assets panel so that you can select it and draw an instance of the user control on the artboard.

To instantiate the user control in another document

  1. If you created a Control Library, add a reference to the .dll in the project in which you want to use your user control. On the Project menu, click Add Reference, browse to the .dll file for your user control in the Add Reference window, and then click Open.

  2. Build your current project (Ctrl+Shift+B) to make the user control available for selection in the Assets panel.

  3. On the Project category of the Assets panel, select your user control. The icon for your user control appears selected underneath the Assets JJ170761.0d8b8d29-1af9-418f-8741-be3097d76eab(it-it,VS.110).png button.

  4. Use your mouse to draw your user control on the artboard.

  5. Test your project (F5) to see your user control in action.

If you created a user control document instead of a control library (.dll), you can enter editing mode for your control by using the shortcut menu.

To edit a user control after it is added to another document

  1. Right-click the user control on the artboard or in the Objects and Timeline panel, and then click Edit Control. Blend for Visual Studio 2012 opens the user control document for editing.

  2. After you make your changes, save your file, and then switch back to the main document.

If you created a user control in a control library project, you have to edit the original control library project, and then rebuild the .dll.

Vedere anche

Attività

Create a user control from existing objects