【问题标题】:Custom Activity override double-click and disable open Activity in detail自定义Activity覆盖双击禁用打开Activity详细
【发布时间】:2012-11-02 10:39:56
【问题描述】:

我正在使用自定义 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();
    }

【问题讨论】:

    标签: workflow-foundation-4 workflow-activity activitydesigner


    【解决方案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());
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-12-01
      • 2013-09-07
      • 2013-12-13
      • 1970-01-01
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多