例如,如果您创建自己的活动,称为run10times,它运行其子活动10次,您是否可以拥有一个包含画布的设计师,用户可以将儿童活动放在其中?

我知道如何创建标准活动设计师,并添加一个expresseTextbox,但不确定如何添加用户可以将儿童活动的画布添加。

有帮助吗?

解决方案

您需要将WorkFlowItemPresenter控件添加到活动设计师中。

假设您有这样的活动:

[Designer(typeof(MyCompositeDesigner))]
public class MyComposite : NativeActivity
{
    public Activity Body { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        context.ScheduleActivity(Body);
    }
}

您将创建这样的设计师:

<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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top