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
targetINotifyPropertyChangedhandlerPropertyChangedEventHandlerEvent 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
objTObject owns the property.
propertyNamestringName of property.
checkPropertyValuePredicate<T>Function to check whether the value is desired one or not.
cancellationTokenCancellationTokenCancellationToken to cancel waiting.
Returns
- Task
Task of waiting for property value.
Type Parameters
TType of object owns the property.