Class NotifyPropertyChangeBaseExtensions
Includes extensions for any object that inherits the NotifyPropertyChangeBase class.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.Mvvm.dll
Syntax
public static class NotifyPropertyChangeBaseExtensions
Methods
| Edit this page View SourceSubscribe<T>(T, Expression<Func<T, object?>>, PropertyChangeObserver)
Subscribes a delegate to be executed when a specific property changes its value.
Declaration
public static void Subscribe<T>(this T instance, Expression<Func<T, object?>> propertySelector, PropertyChangeObserver callback) where T : NotifyPropertyChangeBase
Parameters
Type | Name | Description |
---|---|---|
T | instance | Instance onto which to add the subscription. |
Expression<Func<T, object>> | propertySelector | Expression that selects the property to subscribe the action for. |
PropertyChangeObserver | callback | Action to execute when the property changes its value. |
Type Parameters
Name | Description |
---|---|
T | Type of object to select the observed property from. |
Unsubscribe<T>(T, Expression<Func<T, object?>>)
Removes all previously subscribed actions for the specified property.
Declaration
public static bool Unsubscribe<T>(this T instance, Expression<Func<T, object?>> propertySelector) where T : NotifyPropertyChangeBase
Parameters
Type | Name | Description |
---|---|---|
T | instance | Instance from which to remove the subscription. |
Expression<Func<T, object>> | propertySelector | Expression that selects the property to unsubscribe the previously subscribed actions for. |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |