How to: Add Activities to the Toolbox
Activities can be added to the Toolbox in your solution in several different ways. You can add them from within your current project, reference them from a different project, or reference them from a different assembly.
Add a new custom activity to your current workflow project. For more information about adding a new custom activity to your project, see How to: Add a New Item to a Workflow Project.
Add custom logic to your activity.
Build the project. If the build was successful, a new category in the Toolbox named "<project name>" with the custom activity included in that category is displayed.
If the toolbox is reset, custom activities will be removed, even if the solution is built again. To repopulate the toolbox with custom activities after it has been reset, restart Visual Studio 2010.
The toolbox can only show one activity of a given name. If two activities from different assemblies have the same class name, only one will display.
The application domain is shared among editor instances; if static variables are used, they will be shared among editor instances as well. If this is not the desired behavior, a service should be used to track variable instances. See Using the ModelItem Editing Context for information on using services within the designer.
Open a solution that contains at least one workflow project and either a custom activity library project or another workflow project that defines a custom activity.
Build both projects. If the builds were successful, a new category in the Toolbox named "<project name>" with the custom activity included in that category is displayed.
Open a workflow solution.
From the Tools menu, select Choose Toolbox Items….
In the Choose Toolbox Items dialog box, select the System.Activities Components tab then click Browse… to navigate to the assembly that contains the custom activity you want to add.
Select the assembly and click OK. The custom activity component is added to the list of components and is automatically selected.
- Click OK to close the dialog.
To display the toolbox, select Toolbox from the View menu.
The custom activity appears in the Toolbox under the category that was in focus before the item was added. For example, if the General category was selected in the Toolbox before adding the toolbox item, the activity appears under the General category.