Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

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
)
/** @delegate */
public delegate void PropertyChangedCallback (
	DependencyObject d, 
	DependencyPropertyChangedEventArgs e
)
In XAML, you can use delegates but you cannot define your own.

Parameters

d

The DependencyObject on which the property has changed value.

e

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));
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.