Export (0) Print
Expand All
Expand Minimize

PropertyChangedCallback Delegate

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

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public delegate void PropertyChangedCallback(
	DependencyObject d,
	DependencyPropertyChangedEventArgs e
)

Parameters

d
Type: System.Windows.DependencyObject

The DependencyObject on which the property has changed value.

e
Type: System.Windows.DependencyPropertyChangedEventArgs

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

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.

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft