Chris Owczarek

I'm trying to change the look of a custom activity that inherits from SequenceActivity. I want to have the activity collapsed, non expandable and of a certain colour.

The collapsed, non expandable behaviour I've acheived by creating an activity designer class as follows and this works fine:

[ActivityDesignerTheme(typeof(VehicleEventTrackingDesignerTheme))]
public class VehicleEventTrackingActivityDesigner : SequentialActivityDesigner
{

protected override void Initialize (System.Workflow.ComponentModel.Activity activity)
{
base.Initialize(activity);
this.Text = Resources.Activity_VehicleEvent;
}

public override bool CanExpandCollapse
{
get
{
return false;
}
}

public override bool Expanded
{
get
{
return false;
}
set
{
}
}

}

However, trying to change the colour is not working. I;ve created a designer theme class as follows and associated it with the designer class using an attribute (as above):

internal class VehicleEventTrackingDesignerTheme : ActivityDesignerTheme
{

public VehicleEventTrackingDesignerTheme(WorkflowTheme theme) : base(theme)
{
base.Initialize();
this.BackColorEnd = System.Drawing.Color.Aqua;
this.BackColorStart = System.Drawing.Color.Aquamarine;
this.BackgroundStyle = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal;
this.ForeColor = System.Drawing.Color.Black;
}

}

None of the above properties seem to take affect. I've done exactly the same for a custom activity which extends Activity and not SequenceActivity and this works fine. Any ideas why it's not working for a subclass of SequenceActivity

Cheers, Chris.




Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Tom Lake - MSFT

The only thing I can think of is you aren't adding the DesignerAttribute to the top you your custom sequence. I used the code you provided and added the attribute and when I added the activity to a workflow it looked just like you intended it to.




Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Chris Owczarek

The Designer attribute is there and has effect because the collapse/noexpand behaviour of the designer class is working. I've tried this on other custom sequence activities and the theme class has no effect also. Are you sure your custom activity extends SequenceActivity and not Activity

Chris.




Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Chris Owczarek

This is really weird. I just applied this code to a sequence activity in a completely new workflow project and it worked - once. However I tried changing the colours again and they remain set at aquamarine and aqua and no matter what I do I can't change them.

What's happening here When is the designer theme instantiated And is it being persisted/cached somewhere




Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Ramraj Balasubramanian - MSFT

Hi Chris,

Just a simple change is required. Since youre activity is a composite activity, you need to derive your custom theme from "CompositeDesignerTheme" and not "ActivityDesignerTheme" that should make this work.






Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Tom Lake - MSFT

This is a fairly common problem and it is because each time you build VS caches the newly compiled assembly along with the older version. The easiest way to fix this is to remove any instances of the custom activity from your test workflow, do Build Clean, close and re-open VS. Now build the solution and add the activity to the workflow and you should see the changes reflected.




Re: Windows Workflow Foundation Can't apply designer theme to SequentialActivityDesigner

Chris Owczarek

Many thanks guys for your help. Changing it to use CompositeDesignerTheme does the trick.

Chris.