Class ReactiveNotifyPropertyChangedMixin
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
Extension methods associated with the Observable Changes and the Reactive Notify Property Changed based events.
public static class ReactiveNotifyPropertyChangedMixin
- Inheritance
-
ReactiveNotifyPropertyChangedMixin
Methods
ObservableForProperty<TSender, TValue>(TSender?, Expression<Func<TSender, TValue>>, bool, bool)
ObservableForProperty returns an Observable representing the property change notifications for a specific property on a ReactiveObject. This method (unlike other Observables that return IObservedChange) guarantees that the Value property of the IObservedChange is set.
public static IObservable<IObservedChange<TSender, TValue>> ObservableForProperty<TSender, TValue>(this TSender? item, Expression<Func<TSender, TValue>> property, bool beforeChange = false, bool skipInitial = true)
Parameters
item
TSenderThe source object to observe properties of.
property
Expression<Func<TSender, TValue>>An Expression representing the property (i.e. 'x => x.SomeProperty.SomeOtherProperty'.
beforeChange
boolIf True, the Observable will notify immediately before a property is going to change.
skipInitial
boolIf true, the Observable will not notify with the initial value.
Returns
- IObservable<IObservedChange<TSender, TValue>>
An Observable representing the property change notifications for the given property.
Type Parameters
TSender
The sender type.
TValue
The value type.
ObservableForProperty<TSender, TValue, TRet>(TSender?, Expression<Func<TSender, TValue>>, Func<TValue?, TRet>, bool)
ObservableForProperty returns an Observable representing the property change notifications for a specific property on a ReactiveObject, running the IObservedChange through a Selector function.
public static IObservable<TRet> ObservableForProperty<TSender, TValue, TRet>(this TSender? item, Expression<Func<TSender, TValue>> property, Func<TValue?, TRet> selector, bool beforeChange = false) where TSender : class
Parameters
item
TSenderThe source object to observe properties of.
property
Expression<Func<TSender, TValue>>An Expression representing the property (i.e. 'x => x.SomeProperty'.
selector
Func<TValue, TRet>A Select function that will be run on each item.
beforeChange
boolIf True, the Observable will notify immediately before a property is going to change.
Returns
- IObservable<TRet>
An Observable representing the property change notifications for the given property.
Type Parameters
TSender
The sender type.
TValue
The value type.
TRet
The return value type.
SubscribeToExpressionChain<TSender, TValue>(TSender?, Expression?, bool, bool, bool)
Creates a observable which will subscribe to the each property and sub property specified in the Expression. eg It will subscribe to x => x.Property1.Property2.Property3 each property in the lambda expression. It will then provide updates to the last value in the chain.
public static IObservable<IObservedChange<TSender, TValue>> SubscribeToExpressionChain<TSender, TValue>(this TSender? source, Expression? expression, bool beforeChange = false, bool skipInitial = true, bool suppressWarnings = false)
Parameters
source
TSenderThe object where we start the chain.
expression
ExpressionA expression which will point towards the property.
beforeChange
boolIf we are interested in notifications before the property value is changed.
skipInitial
boolIf we don't want to get a notification about the default value of the property.
suppressWarnings
boolIf true, no warnings should be logged.
Returns
- IObservable<IObservedChange<TSender, TValue>>
A observable which notifies about observed changes.
Type Parameters
TSender
The type of the origin of the expression chain.
TValue
The end value we want to subscribe to.
Exceptions
- InvalidCastException
If we cannot cast from the target value from the specified last property.