ActivityDesigner.CanBeParentedTo Method (CompositeActivityDesigner)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns a value that indicates if a CompositeActivity can be set as the parent of the activity associated with the designer.

Namespace:   System.Workflow.ComponentModel.Design
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

public virtual bool CanBeParentedTo(
	CompositeActivityDesigner parentActivityDesigner
)

Parameters

parentActivityDesigner
Type: System.Workflow.ComponentModel.Design.CompositeActivityDesigner

The CompositeActivityDesigner which can potentially be set as parent.

Return Value

Type: System.Boolean

true if a CompositeActivity can be set as the parent of the activity associated with the designer; otherwise, false.

This method is useful for testing whether a designer can be parented by a particular CompositeActivityDesigner.

This method is called when a user initiates an insertion operation, such as drag-and-drop or paste.

The following example demonstrates how to ensure that a custom activity is parented to specific activity types. In this case, the custom activity can only be parented to a ParallelIfActivity.

public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
{
    if (null == parentActivityDesigner)
        throw new ArgumentNullException("parentActivityDesigner");

    if (!(parentActivityDesigner.Activity is ParallelIfActivity))
        return false;
    else
        return base.CanBeParentedTo(parentActivityDesigner);
}

.NET Framework
Available since 3.0
Return to top
Show: