Method SetProperty
SetProperty<T>(ref T, T, string)
Sets the value of a property and raises the PropertyChanged event if the value has changed.
protected virtual bool SetProperty<T>(ref T storage, T value, string propertyName = null)
Parameters
storageTThe reference to the backing field of the property.
valueTThe new value of the property.
propertyNamestringThe name of the property.
Returns
- bool
trueif the property value has changed; otherwise,false.
Type Parameters
TThe type of the property.
SetProperty<T>(ref T, T, Action, string)
Sets the value of a property and raises the PropertyChanged event if the value has changed. Additionally, invokes the specified action when the property value has changed.
protected virtual bool SetProperty<T>(ref T storage, T value, Action onChanged, string propertyName = null)
Parameters
storageTThe reference to the backing field of the property.
valueTThe new value of the property.
onChangedActionThe action to invoke when the property value has changed.
propertyNamestringThe name of the property.
Returns
- bool
trueif the property value has changed; otherwise,false.
Type Parameters
TThe type of the property.