工作流自定义活动构建工作流参数

发布于 2024-08-13 12:48:17 字数 191 浏览 2 评论 0原文

假设我有一个具有 2 个依赖属性的工作流程:Prop1、Prop2。

我想创建一个自定义活动,当我拖入工作流程时,它将在设计器的属性网格中显示 Prop1 和 Prop2。

这可能吗?

与 invokeWorkflow 一样,当您选择 TargetWorkflow 时,它会使用工作流的参数填充属性网格,以便您可以绑定。

Let's say I have a Workflow with 2 dependency Property : Prop1, Prop2.

I'd like to create a custom activity that when I drag into the workflow, It will show Prop1 and Prop2 in the property grid in the designer.

Is this possible ?

Like the invokeWorkflow, when you select the TargetWorkflow, it populates the property grid with Parameters of the workflow, so that you can bind.

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

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

发布评论

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

评论(3

生生不灭 2024-08-20 12:48:17

您可以尝试这样的操作:

http:// /blogs.microsoft.co.il/blogs/bursteg/archive/2006/10/29/DynamicWorkflowBindingParameters.aspx

我在设计时做了很多深入研究动态创建属性,并且我已经取得了一些成功。

但是,我无法让动态属性显示在实际的属性绑定显示中。因此,您可以在设计器中动态创建属性并设置它们,但您可以设置其他属性以指向动态属性。

这似乎是 Visual Studio 中工作流设计器的限制。我看不出工作流引擎本身无法处理这个问题的原因。

You could try something like this:

http://blogs.microsoft.co.il/blogs/bursteg/archive/2006/10/29/DynamicWorkflowBindingParameters.aspx

I've been doing quite a bit of digging into dynamically creating properties during design time and I've had some success with it.

However, I haven't been able to get dynamic properties to show up in the actual property binding display. So you can create properties dynamically in the designer and set them, but you can set other properties to point to your dynamic properties.

This appears to be a limitation of the workflow designer in visual studio. I can't see a reason why the workflow engine itself can't handle this.

守望孤独 2024-08-20 12:48:17

您不需要执行任何操作,默认情况下所有公共属性都显示在属性网格中。

You shouldn't need to do anything, by default all public properties are displayed in the property grid.

倥絔 2024-08-20 12:48:17

如果您像这样定义每个属性,则绑定应该可用:

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Parameters")]
public static readonly DependencyProperty CustomParamProperty
    = DependencyProperty.Register("CustomParam", typeof(int), typeof(CustomActivityClass));

public int CustomParam
{
    get { return (int)GetValue(CustomParamProperty); }
    set {SetValue(CustomParamProperty, value); }
}

祝您好运!

If you define each one of your properties like this, the binding should be available:

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Parameters")]
public static readonly DependencyProperty CustomParamProperty
    = DependencyProperty.Register("CustomParam", typeof(int), typeof(CustomActivityClass));

public int CustomParam
{
    get { return (int)GetValue(CustomParamProperty); }
    set {SetValue(CustomParamProperty, value); }
}

Good Luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文