DependencyPropertyChangedEventArgs.OldValue property

Applies to Windows and Windows Phone

Gets the value of the dependency property before the reported change.

Syntax


public object OldValue { get; }

Property value

Type: System.Object [.NET] | Platform::Object [C++]

The dependency property value before the change.

Remarks

The OldValue value is often used as the value that the property is set to from within the callback, in case the NewValue value is not considered a valid value for your property's logic . For example, if you are using the callback for validation of an input value for a property that the user can set in UI, the previous value is typically a better value to use as the current value rather than resetting the value to a default. The callback is effectively canceling a change.

A PropertyChangedCallback implementation is an optional part of the property metadata that you provide when you register a dependency property. The callback is invoked by the dependency property system internally. For more info on dependency properties in general, see Custom dependency properties and Dependency properties overview.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

DependencyPropertyChangedEventArgs
Dependency properties overview

 

 

Show:
© 2014 Microsoft