この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

Binding.TargetUpdated アタッチされるイベント

値がバインディング ターゲットからバインディング ソースに転送されたときに、NotifyOnTargetUpdated 値が true に設定されたバインディングでのみ発生します。

名前空間:  System.Windows.Data
アセンブリ:  PresentationFramework (PresentationFramework.dll 内)
XAML の XMLNS: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
See AddTargetUpdatedHandler, RemoveTargetUpdatedHandler
<object Binding.TargetUpdated="EventHandler<DataTransferEventArgs>" .../>

識別子フィールド

TargetUpdatedEvent

ルーティング方法

バブル

Delegate

EventHandler<TEventArgs>DataTransferEventArgs に対する制約あり。

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 方法 : プロパティの変更通知を実装する.

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.

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:


private 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.

.NET Framework

サポート対象: 4、3.5、3.0

.NET Framework Client Profile

サポート対象: 4、3.5 SP1

Windows 7, Windows Vista SP1 以降, Windows XP SP3, Windows Server 2008 (Server Core はサポート対象外), Windows Server 2008 R2 (SP1 以降で Server Core をサポート), Windows Server 2003 SP2

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ