DependencyObject.SetBinding(DependencyProperty, ActivityBind) 方法

定義

設定所指定 ActivityBindDependencyProperty

public:
 void SetBinding(System::Workflow::ComponentModel::DependencyProperty ^ dependencyProperty, System::Workflow::ComponentModel::ActivityBind ^ bind);
public void SetBinding (System.Workflow.ComponentModel.DependencyProperty dependencyProperty, System.Workflow.ComponentModel.ActivityBind bind);
member this.SetBinding : System.Workflow.ComponentModel.DependencyProperty * System.Workflow.ComponentModel.ActivityBind -> unit
Public Sub SetBinding (dependencyProperty As DependencyProperty, bind As ActivityBind)

參數

dependencyProperty
DependencyProperty

DependencyProperty

bind
ActivityBind

要設定的 ActivityBind

例外狀況

其中一個引數是 null 參考 (Visual Basic 中為 Nothing)。

DependencyProperty 建立關聯的 PropertyMetadata 為唯讀、是中繼資料,或是不可繫結。

這個執行個體不在 DesignMode 中。

範例

下列程式碼示範如何建立活動,然後將活動加入至複合活動做為子系,並且包含為這個型別設定 CanModifyActivities 權限。

此外,說明 SetBinding 方法的使用。

這個程式碼範例是 ThrowWorkflow.cs 檔案中<擲回 SDK>範例的一部分。 如需詳細資訊,請參閱 使用 Throw

this.Delay.Name = "Delay";
this.Delay.TimeoutDuration = System.TimeSpan.Parse("00:00:05");
Me.Delay.Name = "Delay"
Me.Delay.TimeoutDuration = System.TimeSpan.Parse("00:00:05")

備註

SetValue 會直接將值設定為 DependencyProperty。 同樣的,AddHandler 將處理常式直接加入型別事件的屬性。

這些方法在呼叫相同屬性時是互斥的。 如果呼叫 SetBinding,則先前使用 SetValue (在事件中的 AddHandler) 設定的值會被忽略。 反之亦相同:SetValue (AddHandler) 會重設使用 SetBinding 指派的繫結程序。

適用於