Table of Contents

Class NotifyPropertyChangedExtensions

Namespace
CarinaStudio.ComponentModel
Assembly
CarinaStudio.AppBase.Core.dll

Extensions for INotifyPropertyChanged.

public static class NotifyPropertyChangedExtensions
Inheritance
NotifyPropertyChangedExtensions
Inherited Members

Methods

AddWeakPropertyChangedEventHandler(INotifyPropertyChanged, PropertyChangedEventHandler)

Add weak event handler to PropertyChanged.

public static IDisposable AddWeakPropertyChangedEventHandler(this INotifyPropertyChanged target, PropertyChangedEventHandler handler)

Parameters

target INotifyPropertyChanged

INotifyPropertyChanged.

handler PropertyChangedEventHandler

Event handler.

Returns

IDisposable

IDisposable which represents added weak event handler. You can call Dispose() to remove weak event handler explicitly.

WaitForPropertyChangeAsync<T>(T, string, Predicate<T>, CancellationToken)

Wait for the property changing to desired value asynchronously.

public static Task WaitForPropertyChangeAsync<T>(this T obj, string propertyName, Predicate<T> checkPropertyValue, CancellationToken cancellationToken = default) where T : INotifyPropertyChanged

Parameters

obj T

Object owns the property.

propertyName string

Name of property.

checkPropertyValue Predicate<T>

Function to check whether the value is desired one or not.

cancellationToken CancellationToken

CancellationToken to cancel waiting.

Returns

Task

Task of waiting for property value.

Type Parameters

T

Type of object owns the property.