Workflow Foundation (WF) -- Why does Visual Studio's designer not use my custom ActivityDesignerThem

Posted by stakx on Stack Overflow See other posts from Stack Overflow or by stakx
Published on 2010-04-19T17:10:33Z Indexed on 2010/04/19 17:13 UTC
Read the original article Hit count: 515

Problem:

I am trying to customize a custom Workflow Foundation activity (called CustomActivity) so that it will display with a specific background color.

What I've got so far:

First, I'm defining a custom ActivityDesignerTheme as follows:

public class CustomActivityTheme : ActivityDesignerTheme
{
    public CustomActivityTheme(WorkflowTheme theme) : base(theme)
    {
        this.BackColorStart = Color.FromArgb(0xff, 0xf4, 0xf4, 0xf4);
        this.BackColorEnd = Color.FromArgb(0xff, 0xc0, 0xc0, 0xc0);
        this.BackgroundStyle = LinearGradientMode.Horizontal;
    }
}

Then, I am applying this theme to a custom ActivityDesigner (apparently the theme must be applied to a designer, and not to an activity):

[ActivityDesignerTheme(typeof(CustomActivityTheme))]
public class CustomActivityDesigner : SequentialActivityDesigner
{
    ...
}

Ultimately, I am applying the custom designer to my custom Activity:

[Designer(typeof(CustomActivityDesigner))]
public partial class CustomActivity : SequenceActivity
{
    ...
}

Now, according to some code examples that I've seen, this should do the trick.

However, when I include an instance of my CustomActivity in a workflow, my custom theme is not applied and it is displayed in the Visual Studio Designer as any standard activity would (white background etc.). I tried re-compiling and even re-starting Visual Studio a couple of times, just to make sure the used assembly is up-to-date, but to no avail.

My question:

What am I missing? Why does Visual Studio's Workflow Designer not respect the CustomActivityTheme when it displays a CustomActivity?

© Stack Overflow or respective owner

Related posts about .net-3.5

Related posts about workflow-foundation