DependencyPropertyChangedEventArgs.Property Property

Definition

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

public:
 property DependencyProperty ^ Property { DependencyProperty ^ get(); };
DependencyProperty Property();
public DependencyProperty Property { get; }
var dependencyProperty = dependencyPropertyChangedEventArgs.property;
Public ReadOnly Property Property As DependencyProperty

Property Value

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

Applies to

See also