Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Binding.NotifyOnTargetUpdated Property

Gets or sets a value that indicates whether to raise the TargetUpdated event when a value is transferred from the binding source to the binding target.

Namespace: System.Windows.Data
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public bool NotifyOnTargetUpdated { get; set; }
/** @property */
public boolean get_NotifyOnTargetUpdated ()

/** @property */
public void set_NotifyOnTargetUpdated (boolean value)

public function get NotifyOnTargetUpdated () : boolean

public function set NotifyOnTargetUpdated (value : boolean)

<object NotifyOnTargetUpdated="bool" .../>

Property Value

true if the TargetUpdated event should be raised when the binding target value is updated; otherwise, false. The default value is false.

This example shows how to set up to be notified when the binding target (target) or the binding source (source) property of a binding has been updated.

Windows Presentation Foundation (WPF) raises a data update event each time that the binding source or target has been updated. Internally, this event is used to inform the user interface (UI) that it should update, because the bound data has changed. Note that for these events to work, and also for one-way or two-way binding to work properly, you need to implement your data class using the INotifyPropertyChanged interface. For more information, see Implement Property Change Notification.

Set the NotifyOnTargetUpdated or NotifyOnSourceUpdated property (or both) to true in the binding. The handler you provide to listen for this event must be attached directly to the element where you want to be informed of changes, or to the overall data context if you want to be aware that anything in the context has changed.

For the complete sample, see Binding Modes Sample.

Here is an example that shows how to set up for notification when a target property has been updated.

<TextBlock Grid.Row="1" Grid.Column="1" Name="RentText"
  Text="{Binding Path=Rent, Mode=OneWay, NotifyOnTargetUpdated=True}"
  TargetUpdated="OnTargetUpdated"/>

You can then assign a handler based on the EventHandler<T> delegate, OnTargetUpdated in this example, to handle the event:

public void OnTargetUpdated(Object sender, DataTransferEventArgs args)
{

  // Handle event

...

}

Parameters of the event can be used to determine details about the property that changed (such as the type or the specific element if the same handler is attached to more than one element), which can be useful if there are multiple bound properties on a single element.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft