For example if you create your own activity called Run10Times which runs its child activity 10 times, can you have a designer which contains a canvas to which the user can put the child activity?
I know how to create a standard activity designer, and add a expressiontextbox, but not sure how to add a canvas to which the user can put child activities.
You need to add the WorkflowItemPresenter control to your activity designer.
Suppose you have an activity like this:
[Designer(typeof(MyCompositeDesigner))]
public class MyComposite : NativeActivity
{
public Activity Body { get; set; }
protected override void Execute(NativeActivityContext context)
{
context.ScheduleActivity(Body);
}
}
you would create designer like this:
<sap:ActivityDesigner x:Class="WorkflowConsoleApplication3.MyCompositeDesigner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation">
<StackPanel>
<TextBlock Text="Activity to execute:"
Margin="6"/>
<sap:WorkflowItemPresenter Item="{Binding Path=ModelItem.Body, Mode=TwoWay}"
HintText="Drop Activity"
/>
</StackPanel>
</sap:ActivityDesigner>