This documentation is archived and is not being maintained.

ActivityDesigner.CanBeParentedTo Method

Gets 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);
}

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: