BindableBase.SetProperty<T> Method
Checks if a property already matches a desired value. Sets the property and notifies listeners only when necessary.
Namespace: Microsoft.Practices.Prism.Mvvm
Assembly: Microsoft.Practices.Prism.Mvvm (in Microsoft.Practices.Prism.Mvvm.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
protected virtual bool SetProperty<T>(
ref T storage,
T value,
string propertyName = null
)
'Declaration
Protected Overridable Function SetProperty(Of T) (
ByRef storage As T,
value As T,
Optional propertyName As String = Nothing
) As Boolean
Parameters
- storage
Type: T%
Reference to a property with both getter and setter.
- value
Type: T
Desired value for the property.
- propertyName (Optional)
Type: System.String
Name of the property used to notify listeners. This value is optional and can be provided automatically when invoked from compilers that support CallerMemberName.
Type Parameters
- T
Type of the property.
Return Value
Type: Boolean
True if the value was changed, false if the existing value matched the desired value.