-
-
Notifications
You must be signed in to change notification settings - Fork 230
EventInvokerSelectionInjection
SimonCropp edited this page Mar 21, 2013
·
3 revisions
Event invoker is the method that actually fires the PropertyChanged
event. Although it is not part of the INotifyPropertyChanged
interface the standard form is as follows
public virtual void OnPropertyChanged(string propertyName)
{
var propertyChanged = PropertyChanged;
if (propertyChanged != null)
{
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
The name of the event invoker method can be changed (from its default of OnPropertyChanged
) using the EventInvokerNames
property.
For example if you are using the Caliburn base class the following could be used
<Weavers>
<PropertyChanged EventInvokerNames="RaisePropertyChange"/>
</Weavers>
So in all examples you can exchange "OnPropertyChanged" with whatever you have selected using EventInvokerNames
.
Note: you actually do not need to set EventInvokerNames
for Caliburn because it is automatically derived. See SupportedToolkits
The event invoker call is done as follows
- Try to find a method with the following signature in the class hierarchy (where method name matches
EventInvokerNames
)OnPropertyChanged(string propertyName)
- If no method is found then the standard OnPropertyChanged code (listed above) is injected.