Edit

Share via


PropertyChangedCallback Delegate

Definition

Represents the callback that is invoked when the effective property value of a dependency property changes.

C#
public delegate void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e);

Parameters

d
DependencyObject

The DependencyObject on which the property has changed value.

e
DependencyPropertyChangedEventArgs

Event data that is issued by any event that tracks changes to the effective value of this property.

Examples

The following example registers a new dependency property, using the signature that specifies a PropertyChangedCallback. The PropertyChangedCallback is used to create a callback that changes an internal property whenever the public property changes.

C#
public static readonly DependencyProperty AquariumGraphicProperty = DependencyProperty.Register(
  "AquariumGraphic",
  typeof(Uri),
  typeof(AquariumObject),
  new FrameworkPropertyMetadata(null,
      FrameworkPropertyMetadataOptions.AffectsRender, 
      new PropertyChangedCallback(OnUriChanged)
  )
);
C#
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
  Shape sh = (Shape) d;
  sh.Fill = new ImageBrush(new BitmapImage((Uri)e.NewValue));
}

Extension Methods

GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9