DependencyObject.SetBinding(DependencyProperty, ActivityBind) Método

Definição

Define o ActivityBind para o DependencyProperty especificado.Sets the ActivityBind for the specified DependencyProperty.

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)

Parâmetros

bind
ActivityBind

O ActivityBind para o qual definir.The ActivityBind to set to.

Exceções

Um dos argumentos é uma referência nula (Nothing no Visual Basic).Either of the arguments is a null reference (Nothing in Visual Basic).

O PropertyMetadata associado com o DependencyProperty é somente leitura, é um metadado ou não é associável.The PropertyMetadata associated with the DependencyProperty is read-only, is metadata, or is not bindable.

Esta instância não está em DesignMode.This instance is not in DesignMode.

Exemplos

O código a seguir mostra como criar atividades e adicioná-las como filhos a uma atividade composta e inclui a definição da CanModifyActivities permissão para esse tipo.The following code shows how to create activities and add them as children to a composite activity and includes setting the CanModifyActivities permission for this type.

Além disso, o uso do SetBinding método é ilustrado.In addition, the use of the SetBinding method is illustrated.

Este exemplo de código faz parte do exemplo do SDK de throw e é do arquivo ThrowWorkFlow. cs.This code example is part of the Throw SDK sample and is from the ThrowWorkFlow.cs file. Para obter mais informações, consulte usando o throw.For more information, see Using 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")

Comentários

SetValue define o valor diretamente para DependencyProperty .SetValue sets the value directly to the DependencyProperty. Da mesma forma, AddHandler o adiciona um manipulador diretamente às propriedades do tipo Event.Similarly, AddHandler adds a handler directly to properties of type event.

Esses métodos são exclusivos quando são chamados para a mesma propriedade.These methods are exclusive when they are called for the same property. Se SetBinding for chamado, os valores definidos anteriormente usando SetValue ( AddHandler em eventos) serão desconsiderados.If SetBinding is called, then the values previously set using SetValue (AddHandler in events) are disregarded. O mesmo é realmente o contrário: SetValue ( AddHandler ) redefine a associação atribuída com SetBinding .The same is true the other way around: SetValue (AddHandler) resets the binding assigned with SetBinding.

Aplica-se a