0

我正在使用自定义活动并重写OnMouseDoubleClick方法。一切正常,但双击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(); 
    } 

回答

1

代码要禁用behabiour你已经使用ActivityDesignerOptionsAttribute,特别是其AllowDrillIn财产。

用它在你的活动类:如果你使用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()); 
    } 
}