Partilhar via


Basic Activity Designer Sample

Download sample

This sample illustrates how to add a custom configuration error and a custom context menu to the designer that is associated with an activity.

In the sample, two features are added to the designer that is associated with a custom activity (source file: CustomActivity.cs):

  • A custom configuration error.

  • A custom context menu that is displayed when the user right-clicks the activity in the workflow designer.

To add a custom configuration error, the sample activity implements a custom activity designer that is based on ActivityDesigner, and overrides the DesignerActions property to return the custom error.

To add a custom context menu item, the custom activity designer overrides the OnExecuteDesignerAction event to display the custom message (although any functionality could be inserted here). It also overrides the Verbs collection to include a new menu item.

This sample also illustrates how to use a custom activity designer theme, so that the activity appears as yellow in the workflow designer.

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. Open the BasicActivityDesignerWorkflow.cs source file in the workflow designer by double-clicking the file in Visual Studio's Solution Explorer. (The same behavior could be accomplished in your custom workflow designer. Visual Studio will be used in this sample to demonstrate this behavior.)

    Notice that the configuration error displays an Insert Text Here entry.

  2. Right-click the activity, and notice that there is a Custom Context Menu entry.

    Selecting this option displays a message box.

See Also

Reference

ActivityDesigner

Other Resources

Creating a Custom Activity Designer
Simple Activity Sample
Custom Activities Samples

© 2007 Microsoft Corporation. All rights reserved.