C# Class Catel.Data.ChangeNotificationWrapper

Wrapper for an object that implements the INotifyPropertyChanged and INotifyCollectionChanged. This class is thread-safe and uses weak events to prevent memory leaks.
Afficher le fichier Open project: Catel/Catel Class Usage Examples

Méthodes publiques

Méthode Description
ChangeNotificationWrapper ( object value ) : System

Initializes a new instance of the ChangeNotificationWrapper class.

IsUsefulForObject ( object obj ) : bool

Determines whether creating a ChangeNotificationWrapper is useful for the specified object. An object is considered usable when it implements either INotifyPropertyChanged or INotifyCollectionChanged.

OnObjectCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Called when the target object raises the INotifyCollectionChanged.CollectionChanged event.

This method is public to allow the usage of the WeakEventListener, do not call this method yourself.

OnObjectCollectionItemPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when the target object raises the INotifyPropertyChanged.PropertyChanged event of an object that is located inside the collection being monitored.

This method is public to allow the usage of the WeakEventListener, do not call this method yourself.

OnObjectPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when the target object raises the INotifyPropertyChanged.PropertyChanged event.

This method is public to allow the usage of the WeakEventListener, do not call this method yourself.

SubscribeNotifyChangedEvents ( object value, ICollection parentCollection ) : void

Subscribes to the notify changed events.

UnsubscribeFromAllEvents ( ) : void

Unsubscribes from all events.

UnsubscribeNotifyChangedEvents ( object value, ICollection parentCollection ) : void

Unsubscribes from the notify changed events.

No need to check for weak events, they are unsubscribed automatically.

UpdateCollectionSubscriptions ( ICollection collection ) : void

Updates all the collection subscriptions. This method is internally used when a notifiable collection raises the NotifyCollectionChangedAction.Reset event.

Private Methods

Méthode Description
SubscribeNotifyChangedEvent ( object value, EventChangeType eventChangeType, ICollection parentCollection ) : void
UnsubscribeNotifyChangedEvent ( object value, EventChangeType eventChangeType, ICollection parentCollection ) : void

Method Details

ChangeNotificationWrapper() public méthode

Initializes a new instance of the ChangeNotificationWrapper class.
The is null or whitespace.
public ChangeNotificationWrapper ( object value ) : System
value object The value.
Résultat System

IsUsefulForObject() public static méthode

Determines whether creating a ChangeNotificationWrapper is useful for the specified object. An object is considered usable when it implements either INotifyPropertyChanged or INotifyCollectionChanged.
public static IsUsefulForObject ( object obj ) : bool
obj object The object to check.
Résultat bool

OnObjectCollectionChanged() public méthode

Called when the target object raises the INotifyCollectionChanged.CollectionChanged event.
This method is public to allow the usage of the WeakEventListener, do not call this method yourself.
public OnObjectCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void
sender object The sender.
e System.Collections.Specialized.NotifyCollectionChangedEventArgs The instance containing the event data.
Résultat void

OnObjectCollectionItemPropertyChanged() public méthode

Called when the target object raises the INotifyPropertyChanged.PropertyChanged event of an object that is located inside the collection being monitored.
This method is public to allow the usage of the WeakEventListener, do not call this method yourself.
public OnObjectCollectionItemPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void
sender object The sender.
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
Résultat void

OnObjectPropertyChanged() public méthode

Called when the target object raises the INotifyPropertyChanged.PropertyChanged event.
This method is public to allow the usage of the WeakEventListener, do not call this method yourself.
public OnObjectPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void
sender object The sender.
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
Résultat void

SubscribeNotifyChangedEvents() public méthode

Subscribes to the notify changed events.
public SubscribeNotifyChangedEvents ( object value, ICollection parentCollection ) : void
value object The object to subscribe to.
parentCollection ICollection If not null, this is a collection item which should use .
Résultat void

UnsubscribeFromAllEvents() public méthode

Unsubscribes from all events.
public UnsubscribeFromAllEvents ( ) : void
Résultat void

UnsubscribeNotifyChangedEvents() public méthode

Unsubscribes from the notify changed events.
No need to check for weak events, they are unsubscribed automatically.
public UnsubscribeNotifyChangedEvents ( object value, ICollection parentCollection ) : void
value object The object to unsubscribe from.
parentCollection ICollection The parent collection.
Résultat void

UpdateCollectionSubscriptions() public méthode

Updates all the collection subscriptions. This method is internally used when a notifiable collection raises the NotifyCollectionChangedAction.Reset event.
public UpdateCollectionSubscriptions ( ICollection collection ) : void
collection ICollection
Résultat void