Επεξεργασία

Κοινή χρήση μέσω


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);
public virtual bool CanBeParentedTo (System.Workflow.ComponentModel.Design.CompositeActivityDesigner parentActivityDesigner);
abstract member CanBeParentedTo : System.Workflow.ComponentModel.Design.CompositeActivityDesigner -> bool
override this.CanBeParentedTo : System.Workflow.ComponentModel.Design.CompositeActivityDesigner -> bool
Public Overridable Function CanBeParentedTo (parentActivityDesigner As CompositeActivityDesigner) As Boolean

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);
}
Public Overrides Function CanBeParentedTo(ByVal parentActivityDesigner As CompositeActivityDesigner) As Boolean
    If parentActivityDesigner Is Nothing Then
        Throw New ArgumentNullException("parentActivityDesigner")
    End If

    If Not TypeOf parentActivityDesigner.Activity Is ParallelIfActivity Then
        Return False
    Else
        Return MyBase.CanBeParentedTo(parentActivityDesigner)
    End If
End Function

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