Class NotifyPropertyChangedEx
- Namespace
- DynamicData.Binding
- Assembly
- DynamicData.dll
Property changes notification.
public static class NotifyPropertyChangedEx
- Inheritance
-
NotifyPropertyChangedEx
Methods
WhenAnyPropertyChanged<TObject>(TObject, params string[])
Notifies when any property on the object has changed.
public static IObservable<TObject?> WhenAnyPropertyChanged<TObject>(this TObject source, params string[] propertiesToMonitor) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source.
propertiesToMonitor
string[]specify properties to Monitor, or omit to monitor all property changes.
Returns
- IObservable<TObject>
A observable which includes notifying on any property.
Type Parameters
TObject
The type of the object.
WhenChanged<TObject, TResult, TProperty1>(TObject, Expression<Func<TObject, TProperty1>>, Func<TObject, TProperty1?, TResult>, Func<TProperty1>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Func<TObject, TProperty1?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
resultSelector
Func<TObject, TProperty1, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
WhenChanged<TObject, TResult, TProperty1, TProperty2>(TObject, Expression<Func<TObject, TProperty1>>, Expression<Func<TObject, TProperty2>>, Func<TObject, TProperty1?, TProperty2?, TResult>, Func<TProperty1>?, Func<TProperty2>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1, TProperty2>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Expression<Func<TObject, TProperty2>> p2, Func<TObject, TProperty1?, TProperty2?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null, Func<TProperty2>? p2Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
p2
Expression<Func<TObject, TProperty2>>An expression to the second property.
resultSelector
Func<TObject, TProperty1, TProperty2, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
p2Fallback
Func<TProperty2>Provides a fall back value for the second property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
TProperty2
The type of the second property.
WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3>(TObject, Expression<Func<TObject, TProperty1>>, Expression<Func<TObject, TProperty2>>, Expression<Func<TObject, TProperty3>>, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TResult>, Func<TProperty1>?, Func<TProperty2>?, Func<TProperty3>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Expression<Func<TObject, TProperty2>> p2, Expression<Func<TObject, TProperty3>> p3, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null, Func<TProperty2>? p2Fallback = null, Func<TProperty3>? p3Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
p2
Expression<Func<TObject, TProperty2>>An expression to the second property.
p3
Expression<Func<TObject, TProperty3>>An expression to the third property.
resultSelector
Func<TObject, TProperty1, TProperty2, TProperty3, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
p2Fallback
Func<TProperty2>Provides a fall back value for the second property in case of the property value cannot be obtained.
p3Fallback
Func<TProperty3>Provides a fall back value for the third property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
TProperty2
The type of the second property.
TProperty3
The type of the third property.
WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4>(TObject, Expression<Func<TObject, TProperty1>>, Expression<Func<TObject, TProperty2>>, Expression<Func<TObject, TProperty3>>, Expression<Func<TObject, TProperty4>>, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TResult>, Func<TProperty1>?, Func<TProperty2>?, Func<TProperty3>?, Func<TProperty4>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Expression<Func<TObject, TProperty2>> p2, Expression<Func<TObject, TProperty3>> p3, Expression<Func<TObject, TProperty4>> p4, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null, Func<TProperty2>? p2Fallback = null, Func<TProperty3>? p3Fallback = null, Func<TProperty4>? p4Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
p2
Expression<Func<TObject, TProperty2>>An expression to the second property.
p3
Expression<Func<TObject, TProperty3>>An expression to the third property.
p4
Expression<Func<TObject, TProperty4>>An expression to the fourth property.
resultSelector
Func<TObject, TProperty1, TProperty2, TProperty3, TProperty4, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
p2Fallback
Func<TProperty2>Provides a fall back value for the second property in case of the property value cannot be obtained.
p3Fallback
Func<TProperty3>Provides a fall back value for the third property in case of the property value cannot be obtained.
p4Fallback
Func<TProperty4>Provides a fall back value for the fourth property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
TProperty2
The type of the second property.
TProperty3
The type of the third property.
TProperty4
The type of the fourth property.
WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5>(TObject, Expression<Func<TObject, TProperty1>>, Expression<Func<TObject, TProperty2>>, Expression<Func<TObject, TProperty3>>, Expression<Func<TObject, TProperty4>>, Expression<Func<TObject, TProperty5>>, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TProperty5?, TResult>, Func<TProperty1>?, Func<TProperty2>?, Func<TProperty3>?, Func<TProperty4>?, Func<TProperty5>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Expression<Func<TObject, TProperty2>> p2, Expression<Func<TObject, TProperty3>> p3, Expression<Func<TObject, TProperty4>> p4, Expression<Func<TObject, TProperty5>> p5, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TProperty5?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null, Func<TProperty2>? p2Fallback = null, Func<TProperty3>? p3Fallback = null, Func<TProperty4>? p4Fallback = null, Func<TProperty5>? p5Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
p2
Expression<Func<TObject, TProperty2>>An expression to the second property.
p3
Expression<Func<TObject, TProperty3>>An expression to the third property.
p4
Expression<Func<TObject, TProperty4>>An expression to the fourth property.
p5
Expression<Func<TObject, TProperty5>>An expression to the fifth property.
resultSelector
Func<TObject, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
p2Fallback
Func<TProperty2>Provides a fall back value for the second property in case of the property value cannot be obtained.
p3Fallback
Func<TProperty3>Provides a fall back value for the third property in case of the property value cannot be obtained.
p4Fallback
Func<TProperty4>Provides a fall back value for the fourth property in case of the property value cannot be obtained.
p5Fallback
Func<TProperty5>Provides a fall back value for the fifth property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
TProperty2
The type of the second property.
TProperty3
The type of the third property.
TProperty4
The type of the fourth property.
TProperty5
The type of the fifth property.
WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5, TProperty6>(TObject, Expression<Func<TObject, TProperty1>>, Expression<Func<TObject, TProperty2>>, Expression<Func<TObject, TProperty3>>, Expression<Func<TObject, TProperty4>>, Expression<Func<TObject, TProperty5>>, Expression<Func<TObject, TProperty6>>, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TProperty5?, TProperty6?, TResult>, Func<TProperty1>?, Func<TProperty2>?, Func<TProperty3>?, Func<TProperty4>?, Func<TProperty5>?, Func<TProperty6>?)
Produces an observable based on the combined values of the specified properties, including the initial value. ** A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
public static IObservable<TResult?> WhenChanged<TObject, TResult, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5, TProperty6>(this TObject source, Expression<Func<TObject, TProperty1>> p1, Expression<Func<TObject, TProperty2>> p2, Expression<Func<TObject, TProperty3>> p3, Expression<Func<TObject, TProperty4>> p4, Expression<Func<TObject, TProperty5>> p5, Expression<Func<TObject, TProperty6>> p6, Func<TObject, TProperty1?, TProperty2?, TProperty3?, TProperty4?, TProperty5?, TProperty6?, TResult> resultSelector, Func<TProperty1>? p1Fallback = null, Func<TProperty2>? p2Fallback = null, Func<TProperty3>? p3Fallback = null, Func<TProperty4>? p4Fallback = null, Func<TProperty5>? p5Fallback = null, Func<TProperty6>? p6Fallback = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source object.
p1
Expression<Func<TObject, TProperty1>>An expression to the first property.
p2
Expression<Func<TObject, TProperty2>>An expression to the second property.
p3
Expression<Func<TObject, TProperty3>>An expression to the third property.
p4
Expression<Func<TObject, TProperty4>>An expression to the fourth property.
p5
Expression<Func<TObject, TProperty5>>An expression to the fifth property.
p6
Expression<Func<TObject, TProperty6>>An expression to the sixth property.
resultSelector
Func<TObject, TProperty1, TProperty2, TProperty3, TProperty4, TProperty5, TProperty6, TResult>A function which will select the result from the properties and the source.
p1Fallback
Func<TProperty1>Provides a fall back value for the first property in case of the property value cannot be obtained.
p2Fallback
Func<TProperty2>Provides a fall back value for the second property in case of the property value cannot be obtained.
p3Fallback
Func<TProperty3>Provides a fall back value for the third property in case of the property value cannot be obtained.
p4Fallback
Func<TProperty4>Provides a fall back value for the fourth property in case of the property value cannot be obtained.
p5Fallback
Func<TProperty5>Provides a fall back value for the fifth property in case of the property value cannot be obtained.
p6Fallback
Func<TProperty6>Provides a fall back value for the sixth property in case of the property value cannot be obtained.
Returns
- IObservable<TResult>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TResult
The type of the result.
TProperty1
The type of the first property.
TProperty2
The type of the second property.
TProperty3
The type of the third property.
TProperty4
The type of the fourth property.
TProperty5
The type of the fifth property.
TProperty6
The type of the sixth property.
WhenPropertyChanged<TObject, TProperty>(TObject, Expression<Func<TObject, TProperty>>, bool, Func<TProperty?>?)
Observes property changes for the specified property, starting with the current value.
public static IObservable<PropertyValue<TObject, TProperty>> WhenPropertyChanged<TObject, TProperty>(this TObject source, Expression<Func<TObject, TProperty>> propertyAccessor, bool notifyOnInitialValue = true, Func<TProperty?>? fallbackValue = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source.
propertyAccessor
Expression<Func<TObject, TProperty>>The property to observe.
notifyOnInitialValue
boolIf true the resulting observable includes the initial value.
fallbackValue
Func<TProperty>A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
Returns
- IObservable<PropertyValue<TObject, TProperty>>
A observable which also notifies when the property value changes.
Type Parameters
TObject
The type of the object.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
propertyAccessor.
WhenValueChanged<TObject, TProperty>(TObject, Expression<Func<TObject, TProperty>>, bool, Func<TProperty>?)
Observes property changes for the specified property, starting with the current value.
public static IObservable<TProperty?> WhenValueChanged<TObject, TProperty>(this TObject source, Expression<Func<TObject, TProperty>> propertyAccessor, bool notifyOnInitialValue = true, Func<TProperty>? fallbackValue = null) where TObject : INotifyPropertyChanged
Parameters
source
TObjectThe source.
propertyAccessor
Expression<Func<TObject, TProperty>>The property to observe.
notifyOnInitialValue
boolIf true the resulting observable includes the initial value.
fallbackValue
Func<TProperty>A fallback value may be specified to ensure a notification is received when a value is unobtainable. For example when observing Parent.Child.Age, if Child is null the value is unobtainable as Age is a struct and cannot be set to Null. For an object like Parent.Child.Sibling, sibling is an object so if Child is null, the value null and obtainable and is returned as null.
Returns
- IObservable<TProperty>
An observable which emits the results.
Type Parameters
TObject
The type of the object.
TProperty
The type of the first property.