DependencyPropertyChangedEventArgs.NewValue property

This topic has not yet been rated - Rate this topic

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

Syntax


public object NewValue { get; }

Property value

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

The dependency property value after the change.

Remarks

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.

Examples

This example shows a PropertyChangedCallback implementation that uses the DependencyPropertyChangedEventArgs event data. In particular, it uses NewValue to set a related property, which displays the underlying numeric DependencyProperty as a string in a TextBlock part of a composite control.


private static void ValueChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
    NumericUpDown ctl = (NumericUpDown)obj;
    Int32 newValue = (Int32)args.NewValue;

    // Update the TextElement to the new value.
    if (ctl.TextElement != null)
    {
        ctl.TextElement.Text = newValue.ToString();
    }



Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Namespace

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

Metadata

Windows.winmd

See also

DependencyPropertyChangedEventArgs
Dependency properties overview

 

 

Build date: 1/31/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.