NotifiableObject
Ecng.ComponentModel
Provides base functionality for notifying property changes to registered observers. Implements both INotifyPropertyChangedEx and INotifyPropertyChanging.
Implementiert: INotifyPropertyChangedEx, INotifyPropertyChanged, INotifyPropertyChanging
Methoden
NotifyChanged
protected void NotifyChanged(string propertyName)
notifiableObject.NotifyChanged(propertyName)
Invokes the property change notification.
- propertyName
- The name of the property that changed. This value is optional and can be provided automatically by the compiler.
NotifyChanging
protected void NotifyChanging(string propertyName)
notifiableObject.NotifyChanging(propertyName)
Raises the PropertyChanging event.
- propertyName
- The name of the property that is changing. This value is optional and can be provided automatically by the compiler.
NotifyPropertyChanged
public void NotifyPropertyChanged(string propertyName)
notifiableObject.NotifyPropertyChanged(propertyName)
Raises the PropertyChanged event.
- propertyName
- The name of the property that changed. This value is optional and can be provided automatically by the compiler.
OnPropertyChanged
protected void OnPropertyChanged(string propertyName)
notifiableObject.OnPropertyChanged(propertyName)
Raises PropertyChanged for the given property. Alias for String).
- propertyName
- The property name. This value is optional and can be provided automatically by the compiler.
OnPropertyChanging
protected void OnPropertyChanging(string propertyName)
notifiableObject.OnPropertyChanging(propertyName)
Raises PropertyChanging for the given property. Alias for String).
- propertyName
- The property name. This value is optional and can be provided automatically by the compiler.
SetProperty``1
protected bool SetProperty<T>(T field, T value, string propertyName)
result = notifiableObject.SetProperty(field, value, propertyName)
Assigns to and raises the changing/changed notifications, but only when the value actually differs.
- field
- Reference to the backing field.
- value
- The new value.
- propertyName
- The property name. This value is optional and can be provided automatically by the compiler.
Rückgabe: if the value changed; otherwise .
Ereignisse
PropertyChanged
public event PropertyChangedEventHandler PropertyChanged
notifiableObject.PropertyChanged += handler
Occurs when a property value has changed.
PropertyChanging
public event PropertyChangingEventHandler PropertyChanging
notifiableObject.PropertyChanging += handler
Occurs when a property value is changing.