Skip to content

Commit 0e695f9

Browse files
committed
Added note about NotifyTaskCompletion<T>
1 parent de9ce77 commit 0e695f9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/mvvm/ObservableObject.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public class MyModel : ObservableObject
8484

8585
Here the `SetPropertyAndNotifyOnCompletion<TTask>(ref TTask, Expression<Func<TTask>>, TTask, string)` method will take care of updating the target field, monitoring the new task, if present, and raising the notification event when that task completes. This way, it's possible to just bind to a task property and to be notified when its status changes.
8686

87+
> [!NOTE]
88+
> The `SetPropertyAndNotifyOnCompletion` method is meant to replace the usage of the `NotifyTaskCompletion<T>` type from the `Microsoft.Toolkit` package. If this type was being used, it can be replaced with just the inner `Task` (or `Task<TResult>`) property, and then the `SetPropertyAndNotifyOnCompletion` method can be used to set its value and raise notification changes. All the properties exposed by the `NotifyTaskCompletion<T>` type are available directly on `Task` instances.
89+
8790
## Sample Code
8891

8992
There are more examples in the [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/UnitTests.Shared/Mvvm).

0 commit comments

Comments
 (0)