Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2\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));
        };
    }
}