4

たとえば、子アクティビティを 10 回実行する Run10Times という独自のアクティビティを作成する場合、ユーザーが子アクティビティを配置できるキャンバスを含むデザイナーを使用できますか?

標準のアクティビティ デザイナーを作成し、式テキスト ボックスを追加する方法は知っていますが、ユーザーが子アクティビティを配置できるキャンバスを追加する方法がわかりません。

4

1 に答える 1

7

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>
于 2010-11-09T09:44:04.390 に答える