Hi, guys,

I am trying to rehost the workflow designer in my own application. I inherited from original SequentialWorkflowActivity to create a new activity with the name "surface", thus to provide a canvas for users to drop their activities into it.

The problem bothering me is that I would like the surface activity to hold certain default activities, for expamle, one such as "start" activity. And I have also created the "start" activity. Previously, I thought of adding a start activity in the surface activity at design time, and when the rehosted designer was loaded, users can have a surface activity with the start activity already embedded in it. But when I put my thought into implementation, I found that adding the start activity in design time renders the surface activity unchangeable, which makes the situation really awful. When I checked the code in InitializeComponent(). I found that VS2005 automatically adds a line of code like this:

this.CanModifyActivities = false;

and this is the reason why. I tried to remove this line, and this only makes an error during compile. I also tried to make the CanModifyActivities return to true again, but the error remains.

Any one has got a suggestion Thank you very much.

Re: Windows Workflow Foundation a problem concerning customized composite activity

Kevin, BJ

The better way i know to do this is to create a custom designer:

1. create a designer inherited from SequentialWorkflowRootDesigner

2. create a class inherited from ActivityToolboxItem and override the method CreateComponentsCore which adds the start activity to the surface activity.

3. use Attribute to specify the above class for your surface activity.

Re: Windows Workflow Foundation a problem concerning customized composite activity

Ramraj Balasubramanian - MSFT

you dont need a custom designer for this. just a custom ActivityToolBoxItem as sugggested by Kevin would do.

so all you need is

1.Create an ActivityToolBoxItem dervied class, override CreateComponentsCore to add the child activity (start)

2. Annotate the CustomActivity ( Surface activity) with [ToolBoxItem(typeof(CustomActivityToolBoxItem))]