Advanced Notification Customization
masterPropertyChanged.Fody provides several ways to intercept or customize how notifications are raised:
- Dependent Properties: Use the
[AlsoNotifyFor]attribute on the source property or[DependsOn]on the target property to manage dependencies. - Interception:
- Class-level: If you define your own
OnPropertyChangedmethod, the weaver will inject calls into your existing method instead of creating a new one. - Property-level: If a method named
On<PropertyName>Changedexists, it will be called.
- Class-level: If you define your own
- Before/After Values: To access the previous and new values during notification, use the signature:
public void OnPropertyChanged(string propertyName, object before, object after). - Opt-in/Opt-out:
- Use
[DoNotNotify]to prevent injection in a specific class. - Use
[assembly: PropertyChanged.FilterType("Regex")]to switch from global injection to an opt-in model where only classes matching the regex are processed.
- Use