PropertyChangedCallback Delegate

Definition

Representa o retorno de chamada que é invocado quando o valor efetivo da propriedade de uma propriedade de dependência é alterado.Represents the callback that is invoked when the effective property value of a dependency property changes.

public delegate void PropertyChangedCallback(DependencyObject ^ d, DependencyPropertyChangedEventArgs e);
public delegate void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e);
type PropertyChangedCallback = delegate of DependencyObject * DependencyPropertyChangedEventArgs -> unit
Public Delegate Sub PropertyChangedCallback(d As DependencyObject, e As DependencyPropertyChangedEventArgs)

Parameters

d
DependencyObject

O DependencyObject no qual a propriedade alterou o valor.The DependencyObject on which the property has changed value.

e
DependencyPropertyChangedEventArgs

Os dados de evento que são emitidos por qualquer evento que rastreia as alterações no valor efetivo dessa propriedade.Event data that is issued by any event that tracks changes to the effective value of this property.

Inheritance
PropertyChangedCallback

Examples

O exemplo a seguir registra uma nova propriedade de dependência, usando a assinatura que especifica um PropertyChangedCallback.The following example registers a new dependency property, using the signature that specifies a PropertyChangedCallback. O PropertyChangedCallback é usado para criar um retorno de chamada que altera uma propriedade interna sempre que a propriedade pública é alterada.The PropertyChangedCallback is used to create a callback that changes an internal property whenever the public property changes.

public static readonly DependencyProperty AquariumGraphicProperty = DependencyProperty.Register(
  "AquariumGraphic",
  typeof(Uri),
  typeof(AquariumObject),
  new FrameworkPropertyMetadata(null,
      FrameworkPropertyMetadataOptions.AffectsRender, 
      new PropertyChangedCallback(OnUriChanged)
  )
);
Public Shared ReadOnly AquariumGraphicProperty As DependencyProperty = DependencyProperty.Register("AquariumGraphic", GetType(Uri), GetType(AquariumObject), New FrameworkPropertyMetadata(Nothing, FrameworkPropertyMetadataOptions.AffectsRender, New PropertyChangedCallback(AddressOf OnUriChanged)))
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
  Shape sh = (Shape) d;
  sh.Fill = new ImageBrush(new BitmapImage((Uri)e.NewValue));
}
Private Shared Sub OnUriChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
    Dim sh As Shape = CType(d, Shape)
    sh.Fill = New ImageBrush(New BitmapImage(CType(e.NewValue, Uri)))
End Sub

Extension Methods

GetMethodInfo(Delegate)

Obtém um objeto que representa o método representado pelo delegado especificado.Gets an object that represents the method represented by the specified delegate.

Applies to