重新托管 Workflow 4 Designer 将 foreach 活动添加到工具箱

发布于 2024-08-27 23:28:37 字数 627 浏览 4 评论 0原文

我正在使用设计器重新托管示例,并尝试将通用类型放入工具箱中,但是我似乎无法使其工作。

我尝试过基于 XAML

<sapt:ToolboxItemWrapper  AssemblyName="{StaticResource AssemblyName}">
    <sapt:ToolboxItemWrapper.ToolName>
        System.Activities.Statements.ForEach
    </sapt:ToolboxItemWrapper.ToolName>
</sapt:ToolboxItemWrapper>

和基于代码:

Type t = Type.GetType("System.Activities.Statements.Foreach, System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
ToolboxItemWrapper w = new ToolboxItemWrapper(t);
category.Add(w);

但是它们似乎都不起作用。有什么建议吗?

I am using the designer rehosting samples and am trying to put the generic types into the toolbox, however I can't seem to make it work.

I've tried XAML based:

<sapt:ToolboxItemWrapper  AssemblyName="{StaticResource AssemblyName}">
    <sapt:ToolboxItemWrapper.ToolName>
        System.Activities.Statements.ForEach
    </sapt:ToolboxItemWrapper.ToolName>
</sapt:ToolboxItemWrapper>

and code based:

Type t = Type.GetType("System.Activities.Statements.Foreach, System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
ToolboxItemWrapper w = new ToolboxItemWrapper(t);
category.Add(w);

however neither of them seem to work. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青芜 2024-09-03 23:28:37

您遗漏了不起作用的内容,但我假设您无法将子活动添加到设计器中的 ForEach 中。

如果是这种情况,那是因为 Body属性是一个ActivityAction而不是一个Activity,它需要被初始化。有多种方法可以执行此操作,但最简单的方法是开始使用 ForEachWithBodyFactory 在设计器中,并将其拖到设计图面上。

以下代码对我有用。我可以将 ForEach 拖到工作流程上并向其中添加子项目。

var cat = new ToolboxCategory("Standard Activities");
cat.Add(new ToolboxItemWrapper(typeof(ForEachWithBodyFactory<>)));

You are leaving out what isn't working but I assume you can't add a child activity to the ForEach in the designer.

If that is the case that is because the Body property is an ActivityAction not an Activity and it needs to be initialized. There are several ways of doing this but the easiest is to get started with the ForEachWithBodyFactory in the designer and drag that onto the design surface instead.

The following code works for me. I can drag the ForEach onto a workflow and add child items to it.

var cat = new ToolboxCategory("Standard Activities");
cat.Add(new ToolboxItemWrapper(typeof(ForEachWithBodyFactory<>)));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文