0

我正在使用自定义 Activity 并覆盖 OnMouseDoubleClick 方法。一切正常,但双击 Activity 后,设计器中的自我显示。这意味着在设计器中未显示整个工作流程,而仅显示此活动。如何在自定义设计器中禁用自打开 Activity。这是我在 ActivityDesigner.xaml.cs 中的代码

    /// <summary>
    /// Raises the <see cref="E:System.Windows.Controls.Control.MouseDoubleClick"/> routed event.
    /// </summary>
    /// <param name="e">The event data.</param>
    protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
    {
        e.Handled = true;
        this.OpenDialogOnDoubleClick();
    }
4

1 回答 1

1

要禁用该行为,您必须使用ActivityDesignerOptionsAttribute,尤其是其AllowDrillIn属性。

在您的活动课程中使用它:

[ActivityDesignerOptions(AllowDrillIn = false)]
public sealed class MyActivity : CodedActivity
{
    /* ... */
}


或者,如果您使用的是IRegisterMetadata

internal class Metadata : IRegisterMetadata
{
    private AttributeTable attributes;

    // Called by the designer to register any design-time metadata.
    public void Register()
    {
        var builder = new AttributeTableBuilder();

        builder.AddCustomAttributes(
            typeof(MyActivity),
            new ActivityDesignerOptionsAttribute{ AllowDrillIn = false });

        MetadataStore.AddAttributeTable(builder.CreateTable());
    }
}
于 2012-11-02T23:11:17.250 回答