Export (0) Print
Expand All
Expand Minimize

ActivityDesigner.CanBeParentedTo Method

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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft