ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) Method

定義

傳回值,這個值表示 CompositeActivity 是否可以設定為與設計工具相關聯之活動的父系。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

參數

parentActivityDesigner
CompositeActivityDesigner CompositeActivityDesigner CompositeActivityDesigner CompositeActivityDesigner

CompositeActivityDesigner,其可以設定為父系。The CompositeActivityDesigner which can potentially be set as parent.

傳回

如果 CompositeActivity 可以設定為與設計工具關聯之活動的父系則為 true,否則為 falsetrue if a CompositeActivity can be set as the parent of the activity associated with the designer; otherwise, false.

範例

下列範例示範如何確定特定活動型別是否為某個自訂活動的父系。The following example demonstrates how to ensure that a custom activity is parented to specific activity types. 在此案例中,只有 ParallelIfActivity 可以成為自訂活動的父系。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

備註

在測試特定 CompositeActivityDesigner 是否可以成為設計工具的父系時,這個方法很實用。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.

適用於