Skip to main content

Add Activities to the Workflow Designer Toolbox

  • 2 minutes to read

By default, the Workflow Module allows you to create workflow activities at runtime using the re-hosted Workflow Designer. However, you can also use custom activities created in Visual Studio using the standard approach. This topic describes how to add these activities into the Workflow Designer toolbox.

Note

You can use the same approach to register standard ot third-party activities. The complete example is available in the WorkflowDemo.NETFramework.XPO demo application, installed in the %PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF\WorkflowDemo.NETFramework.XPO, by default.

To add an extra workflow activity, handle the WorkflowWindowsFormsModule.QueryAvailableActivities event in your WinForms application’s Program.cs file. The following code snippet adds the CreateTask activity to the Code Activities toolbox group and associates the “CreateTask” icon with this activity.

static class Program {        
    static void Main(string[] arguments) {
        //...
        MySolutionWindowsFormsApplication winApplication = new MySolutionWindowsFormsApplication();
        //...
        winApplication.Modules.FindModule<WorkflowWindowsFormsModule>().QueryAvailableActivities += 
            delegate(object sender, ActivitiesInformationEventArgs e) {
            e.ActivitiesInformation.Add(new ActivityInformation(typeof(CreateTask), 
            "Code Activities", "Create Task", 
            ImageLoader.Instance.GetImageInfo("CreateTask").Image));
        };
    }
}