>
Defined in Type: ObservableCacheEx
Namespace: DynamicData
Assembly: DynamicData.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, netstandard2.0, net462, net471
public static IObservable<PropertyValue<TObject, TValue>> WhenPropertyChanged<TObject, TKey, TValue>(this IObservable<IChangeSet<TObject, TKey>> source, Expression<Func<TObject, TValue>> propertyAccessor, bool notifyOnInitialValue = true) where TObject : INotifyPropertyChanged where TKey : notnull
Summary: Emits a PropertyValue (item + property value) whenever the specified property changes on any item in the cache. Subscribes via INotifyPropertyChanged using MergeMany.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object (must implement INotifyPropertyChanged). |
TKey | The type of the key. |
TValue | The type of the monitored property. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to observe a specific property on items in. |
propertyAccessor | Expression | A Expression that expression selecting the property to monitor. |
notifyOnInitialValue = true | bool | When true (the default), the current property value is emitted immediately for each item upon subscription. |
Returns: IObservable
Remarks
Per-item subscriptions are created on Add, replaced on Update, disposed on Remove. Errors from individual property subscriptions are silently ignored. The output is not a changeset stream. If you only need the value (not the owning item), use WhenValueChanged instead.
| Event | Behavior |
|---|---|
| Add | Subscribes to the specified property on the new item. If notifyOnInitialValue is true, the current value is emitted immediately. |
| Update | Disposes the old item's property subscription and subscribes to the new item. |
| Remove | Disposes the item's property subscription. No further emissions for this item. |
| Refresh | No effect on subscriptions. The existing property subscription continues. |
| OnError | Per-item property subscription errors are silently ignored. Source errors terminate the stream. |
See also