简体   繁体   中英

How to create a workflow activity with auto-surround sequence designer in wf 4.5?

One of the new improvements of workflow foundation 4.5 is called "Auto Surround With Sequence" and basically is the ability of creating automatically a sequence once you drop an activity within a body that already has an activity within.

http://blogs.msdn.com/b/mcsuksoldev/archive/2012/11/07/workflow-foundation-wf-4-5-designer-improvements.aspx

I have found how to enable this in a Re-hosting project and I can see regular wf 4.5 activities with this functionality enabled (IF-THEN-ELSE fe) but its not working with our custom activities so I presume I have to decorate the activity somehow but I do not know exactly how to do it.

It should be relative simple but all information I found is about re-hosting but not about the usage in custom activities.

So, being new to Activity Designers, I was a little unclear on Bernhard's answer until I delved into the WorkflowItemPresenter implementation. Basically, all you need to do (from an Activity designer point-of-view) is:

<sap:WorkflowItemPresenter Item="{Binding Path=ModelItem.MyNestedActivity, Mode=TwoWay}" 
                           AllowedItemType="sa:Activity" 
                           HintText="Add nested activity here" />

This will work straight away with the standard VS WF4 designer. I'm posting this as this SO thread is the best information I've come across anywhere, and I hope the above xaml helps anybody else with the same issue.

Regards, Julian

you need to set the DesignerConfigurationService AutoSurroundWithSequence property to true and in your and in your designer you also need to define the AllowedActivityType, because the WorkflowItemPresenter just provides that feature if that condition typeof(Activity).IsAssignableFrom(this.AllowedItemType)) is true as well.

regards bernhard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM