Redigera

Dela via


PropertyChangedEventManager.AddHandler Method

Definition

Adds the specified event handler, which is called when specified source raises the PropertyChanged event for the specified property.

public:
 static void AddHandler(System::ComponentModel::INotifyPropertyChanged ^ source, EventHandler<System::ComponentModel::PropertyChangedEventArgs ^> ^ handler, System::String ^ propertyName);
public static void AddHandler (System.ComponentModel.INotifyPropertyChanged source, EventHandler<System.ComponentModel.PropertyChangedEventArgs> handler, string propertyName);
static member AddHandler : System.ComponentModel.INotifyPropertyChanged * EventHandler<System.ComponentModel.PropertyChangedEventArgs> * string -> unit
Public Shared Sub AddHandler (source As INotifyPropertyChanged, handler As EventHandler(Of PropertyChangedEventArgs), propertyName As String)

Parameters

source
INotifyPropertyChanged

The source object that the raises the PropertyChanged event.

handler
EventHandler<PropertyChangedEventArgs>

The delegate that handles the PropertyChanged event.

propertyName
String

The name of the property that exists on source upon which to listen for changes. Set to Empty to indicate "any property".

Exceptions

handler is null.

More than one method is associated with handler.

Remarks

Use this method to specify the event handler you want to use to subscribe to the PropertyChanged event. When you use this method, your listener object does not need to implement the IWeakEventListener interface.

Applies to