FrameworkElement.OnPropertyChanged Method

Invoked whenever the effective value of any dependency property on this FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides OnPropertyChanged.

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

abstract OnPropertyChanged : 
        e:DependencyPropertyChangedEventArgs -> unit  
override OnPropertyChanged : 
        e:DependencyPropertyChangedEventArgs -> unit

Parameters

e
Type: System.Windows.DependencyPropertyChangedEventArgs

The event data that describes the property that changed, as well as old and new values.

This method is not intended to generally detect property changes or invalidations. It is instead intended for modifications of the general invalidation pattern if certain information is known about wide classifications of properties.

This method is potentially invoked many times during the life of an object. Therefore, you can achieve better performance if you override the metadata of specific properties and then attach CoerceValueCallback or PropertyChangedCallback functions for individual properties. However, you would use this method if a FrameworkElement includes a significant number of value-interrelated dependency properties, or if it includes logic such as rendering behavior that must be rerun for several related cases of property invalidations.

Note that there is an identically named OnPropertyChanged method with a different signature (the parameter type is PropertyChangedEventArgs) that can appear on a number of classes. That OnPropertyChanged is used for data object notifications, and is part of the contract for INotifyPropertyChanged.

Notes to Inheritors

Always call the base implementation, as the first operation in your implementation. Failure to do this will significantly disable the entire WPF property system, which causes incorrect values to be reported. The specific FrameworkElement implementation is also responsible for maintaining proper state for a variety of properties that affect the visible user interface. These include invalidating the visual tree based on changes to style at appropriate times.

.NET Framework

Supported in: 4.5.2, 4.5.1, 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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft