开发者

How to create an activity designer that can contain a child activity?

开发者 https://www.devze.com 2023-01-23 19:36 出处:网络
For example if you create your own activity called Run10Times which runs its chil开发者_如何学JAVAd activity 10 times, can you have a designer which contains a canvas to which the user can put the chi

For example if you create your own activity called Run10Times which runs its chil开发者_如何学JAVAd 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消