Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.68 KB

dependencypropertychangedeventargs_property.md

File metadata and controls

39 lines (27 loc) · 1.68 KB
-api-id -api-type
P:Windows.UI.Xaml.DependencyPropertyChangedEventArgs.Property
winrt property

Windows.UI.Xaml.DependencyPropertyChangedEventArgs.Property

-description

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

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

-examples

-see-also

Dependency properties overview