.net-3.5workflow-foundationdesignercustom-activity

Custom activity designers in Workflow Foundation 3.5: How do they work?


Intent of this post:

I realise that Workflow Foundation is not extremely popular on StackOverflow and that there will probably be not many answers, or none at all. This post is intended as a resource to people trying to customise workflow activities' appearance through custom designer classes.


Goals:

I am attempting to create a custom designer class for Workflow activities to achieve the following:

  1. Make activities look less technical. For example, I don't necessarily want to see the internal object name as the activity's "title" -- instead, I'd like to see something more descriptive.

  2. Display the values of certain properties beneath the title text. I would like to see some properties' values directly underneath the title so that I don't need to look somewhere else (namely, at the Properties window).

  3. Provide custom drop areas and draw custom internal arrows. As an example, I would like to be able to have custom drop areas in very specific places.


What I found out so far:

I created a custom designer class deriving from SequentialActivityDesigner as follows:

[Designer(typeof(SomeDesigner))]
public partial class SomeActivity: CompositeActivity
{
    ...
}

class PlainDesigner : SequentialActivityDesigner
{
    ...
}

Through overriding some properties and the OnPaint method, I found out about the following correspondences between the properties and how the activity will be displayed:

Diagram showing the relationships between some properties of a SequentialActivityDesigner and the displayed activity.
Figure 1. Relationship between some properties of an SequentialActivityDesigner and the displayed activity.

Possible solutions for goal #1 (make activities look less technical) and goal #2 (display values of properties beneath title text):


Open questions:


Solution

  • Unless you have a really, really good reason to pour massive amounts (and this is going to be massive) into WF 3.5 then don't. Use WF4 instead. WF4 gives you much more control over the appearance of the activities being rendered using Xaml by WPF.

    WF 3.5 was very technical and very scary to a user. WF4 is designed to address those issues and that seems in line with your goals.