Completed Custom Activity Tutorial
|The project files that are listed here contain the complete source code for the Tutorial: Create a Custom WF Activity tutorial.|
This tutorial explains how to create a basic custom activity that you can use in Windows Workflow Foundation. The activity that is created connects to a Web page and downloads the contents of that page and that data is used by the host application. The custom activity is used in a sequential workflow.
In Task 1: Create the Custom Activity, you can see how to define and raise events that are then handled by the host application. A custom EventArgs object named PageFinishedEventArgs is passed as a parameter during the event. This enables the host application to easily access the page data. Following this, dependency properties are defined in the custom activity. This enables your custom activity to expose properties that can be defined in the workflow that contains it. In this case, a Url property is defined. The host application lets the user enter a URL, and this value is then passed to the sequential workflow as a parameter. In the sequential workflow, an ActivityBind object is used so that whenever the sequential workflow Url property is changed, the corresponding Url property that is defined in the custom activity is changed also. This functionality is demonstrated in Task 2: Use the Custom Activity in a Sequential Workflow.
Other ResourcesCustom Activities
Copyright © 2007 by Microsoft Corporation. All rights reserved.
Last Published: 2010-03-04