Property property
Collapse the table of content
Expand the table of content

DependencyPropertyChangedEventArgs.Property property

Gets the identifier for the dependency property where the value change occurred.

Syntax


public DependencyProperty Property { get; }

Property value

Type: DependencyProperty

The identifier field of the dependency property where the value change occurred.

Remarks

In many cases the dependency property being changed is known implicitly, because you're checking the DependencyPropertyChangedEventArgs data in a callback that's dedicated for use only by one defined dependency property. The Property property makes it possible to share a PropertyChangedCallback as a common callback for more than one PropertyMetadata instance and more than one dependency property. For example, you might have handler logic that first checks Property and then branches behavior (like knowing how to cast NewValue) depending on which property's change invoked the handler in this event case:

private static void OnGravityPropertiesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
    if (e.Property==Planet.GravityFactorProperty) {
        //GravityFactor is a Double, cast e.NewValue to Double, do logic
    }
    if (e.Property==Planet.IsGravityOnProperty) {
        //IsGravityOn is a Boolean, cast e.NewValue to Boolean, do logic
    }
}

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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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:
© 2016 Microsoft