ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) Method

Definition

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

public virtual bool CanBeParentedTo (System.Workflow.ComponentModel.Design.CompositeActivityDesigner parentActivityDesigner);

Parameters

parentActivityDesigner
CompositeActivityDesigner

The CompositeActivityDesigner which can potentially be set as parent.

Returns

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

Examples

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

Remarks

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.

Applies to

מוצר גירסאות
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1