Show / Hide Table of Contents

Class NotifyPropertyChangeBase

Base class for all types that implement a property change notification pattern via either INotifyPropertyChanged or INotifyPropertyChanging.

Inheritance
object
NotifyPropertyChangeBase
NotifyPropertyChange
NotifyPropertyChanged
NotifyPropertyChanging
Implements
INotifyPropertyChangeBase
IRefreshable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public abstract class NotifyPropertyChangeBase : INotifyPropertyChangeBase, IRefreshable

Constructors

| Edit this page View Source

NotifyPropertyChangeBase()

Initializes a new instance of the NotifyPropertyChangeBase

Declaration
protected NotifyPropertyChangeBase()

Methods

| Edit this page View Source

Change<T>(ref T, T, string)

Changes the value of a property's backing field, invoking a property change notification.

Declaration
protected bool Change<T>(ref T field, T value, string propertyName = null)
Parameters
Type Name Description
T field

Backing field to be updated.

T value

New value to be set onto the backing field.

string propertyName

Property name. Must be ommitted, as it's determined at compile time. Implementors of this class must decorate this parameter with the CallerMemberNameAttribute attribute.

Returns
Type Description
bool

true if the value of the backing field has changed; that is, if the original and the new values are considered different. false is returned otherwise.

Type Parameters
Name Description
T

Type of the backing field for the property.

| Edit this page View Source

OnDoChange<T>(ref T, T, string)

Performs the actual value change on a backing field for a property.

Declaration
protected abstract void OnDoChange<T>(ref T field, T value, string propertyName)
Parameters
Type Name Description
T field

Backing field to be updated.

T value

New value to be set onto the backing field.

string propertyName

Name of the property.

Type Parameters
Name Description
T

Type of the backing field for the property.

| Edit this page View Source

OnInitialize(IPropertyBroadcastSetup)

When overriden in a derived class, allows the configuration of property change broadcast and notification triggers

Declaration
protected virtual void OnInitialize(NotifyPropertyChangeBase.IPropertyBroadcastSetup broadcastSetup)
Parameters
Type Name Description
NotifyPropertyChangeBase.IPropertyBroadcastSetup broadcastSetup

Internal instance used to configure the property change broadcast and notification triggers.

| Edit this page View Source

RaisePropertyChangeEvent(in string, in PropertyChangeNotificationType)

Raises the appropriate property change notification event.

Declaration
protected abstract void RaisePropertyChangeEvent(in string propertyName, in PropertyChangeNotificationType notificationType)
Parameters
Type Name Description
string propertyName

Property name for the event to be triggered.

PropertyChangeNotificationType notificationType

Type of property change notification.

| Edit this page View Source

Refresh()

Refreshes the state of this object.

Declaration
public virtual void Refresh()
| Edit this page View Source

Subscribe(Expression<Func<object?>>, PropertyChangeObserver)

Subscribes a delegate to be executed when a specific property changes its value.

Declaration
public void Subscribe(Expression<Func<object?>> propertySelector, PropertyChangeObserver callback)
Parameters
Type Name Description
Expression<Func<object>> propertySelector

Expression that selects the property to subscribe the action for.

PropertyChangeObserver callback

Action to execute when the property changes its value.

| Edit this page View Source

Subscribe(PropertyInfo?, PropertyChangeObserver)

Subscribes a delegate to be executed when a specific property changes its value.

Declaration
public void Subscribe(PropertyInfo? property, PropertyChangeObserver callback)
Parameters
Type Name Description
PropertyInfo property

Property to subscribe the action for.

PropertyChangeObserver callback

Action to execute when the property changes its value.

| Edit this page View Source

Subscribe(PropertyChangeObserver)

Subscribes a delegate to be executed when any property changes its value.

Declaration
public void Subscribe(PropertyChangeObserver callback)
Parameters
Type Name Description
PropertyChangeObserver callback

Action to execute when the property changes its value.

| Edit this page View Source

Unsubscribe(Expression<Func<object?>>)

Removes all previously subscribed actions for the specified property.

Declaration
public bool Unsubscribe(Expression<Func<object?>> propertySelector)
Parameters
Type Name Description
Expression<Func<object>> propertySelector

Expression that selects the property to unsubscribe the previously subscribed actions for.

Returns
Type Description
bool
| Edit this page View Source

Unsubscribe(PropertyInfo?)

Removes all previously subscribed actions for the specified property.

Declaration
public bool Unsubscribe(PropertyInfo? property)
Parameters
Type Name Description
PropertyInfo property

Property for which to remove all subscribed observers. If null is passed, all global subcribers for this instance will be removed.

Returns
Type Description
bool

true if there was a previously registered callback to invoke when the specified property changed its value and has beed removed successfully, false otherwise.

| Edit this page View Source

Unsubscribe(PropertyChangeObserver)

Removes the previously subscribed property change observer.

Declaration
public void Unsubscribe(PropertyChangeObserver callback)
Parameters
Type Name Description
PropertyChangeObserver callback

Delegeta to unsubscribe.

Implements

INotifyPropertyChangeBase
IRefreshable

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
NotifyPropertyChangeBaseExtensions.Subscribe<T>(T, Expression<Func<T, object?>>, PropertyChangeObserver)
NotifyPropertyChangeBaseExtensions.Unsubscribe<T>(T, Expression<Func<T, object?>>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX