You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mvvm/AsyncRelayCommand.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ dev_langs:
9
9
10
10
# AsyncRelayCommand and AsyncRelayCommand<T>
11
11
12
-
The [`AsyncRelayCommand`](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.mvvm.input.AsyncRelayCommand) and [`AsyncRelayCommand<T>`](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.mvvm.input.AsyncRelayCommand-1) are `ICommand` implementations that extend the functionalities offered by [`RelayCommand`](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.mvvm.input.RelayCommand), with support for asynchronous operations.
12
+
The [`AsyncRelayCommand`](/dotnet/api/microsoft.toolkit.mvvm.input.AsyncRelayCommand) and [`AsyncRelayCommand<T>`](/dotnet/api/microsoft.toolkit.mvvm.input.AsyncRelayCommand-1) are `ICommand` implementations that extend the functionalities offered by [`RelayCommand`](/dotnet/api/microsoft.toolkit.mvvm.input.RelayCommand), with support for asynchronous operations.
@@ -20,7 +20,7 @@ The [`AsyncRelayCommand`](https://docs.microsoft.com/dotnet/api/microsoft.toolki
20
20
- They extend the functionalities of the synchronous commands included in the library, with support for `Task`-returning delegates.
21
21
- They can wrap asynchronous functions with an additional `CancellationToken` parameter to support cancelation, and they expose a `CanBeCanceled` and `IsCancellationRequested` properties, as well as a `Cancel` method.
22
22
- They expose an `ExecutionTask` property that can be used to monitor the progress of a pending operation, and an `IsRunning` that can be used to check when an operation completes. This is particularly useful to bind a command to UI elements such as loading indicators.
23
-
- They implement the [`IAsyncRelayCommand`](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.mvvm.input.IAsyncRelayCommand) and [`IAsyncRelayCommand<T>`](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.mvvm.input.IAsyncRelayCommand-1) interfaces, which means that viewmodel can easily expose commands using these to reduce the tight coupling between types. For instance, this makes it easier to replace a command with a custom implementation exposing the same public API surface, if needed.
23
+
- They implement the [`IAsyncRelayCommand`](/dotnet/api/microsoft.toolkit.mvvm.input.IAsyncRelayCommand) and [`IAsyncRelayCommand<T>`](/dotnet/api/microsoft.toolkit.mvvm.input.IAsyncRelayCommand-1) interfaces, which means that viewmodel can easily expose commands using these to reduce the tight coupling between types. For instance, this makes it easier to replace a command with a custom implementation exposing the same public API surface, if needed.
24
24
25
25
## Working with asynchronous commands
26
26
@@ -79,4 +79,5 @@ Upon clicking the `Button`, the command is invoked, and the `ExecutionTask` upda
79
79
80
80
## Examples
81
81
82
-
You can find more examples in the [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/UnitTests.Shared/Mvvm).
82
+
- Check out the [sample app](https://github.com/windows-toolkit/MVVM-Samples) (for multiple UI frameworks) to see the MVVM Toolkit in action.
83
+
- You can also find more examples in the [unit tests](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/rel/7.1.0/UnitTests/UnitTests.Shared/Mvvm).
description: An overview of how to get started with MVVM package and to the APIs it contains
4
+
description: An overview of how to get started with the MVVM Toolkit and to the APIs it contains
5
5
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, get started, visual studio, MVVM, net core, net standard
6
6
dev_langs:
7
7
- csharp
8
8
- vb
9
9
---
10
10
11
-
# Introduction to the MVVM package
11
+
# Introduction to the MVVM Toolkit
12
12
13
-
The `Microsoft.Toolkit.Mvvm` package is a modern, fast, and modular MVVM library. It is part of the Windows Community Toolkit and is built around the following principles:
13
+
The `Microsoft.Toolkit.Mvvm` package (aka MVVM Toolkit) is a modern, fast, and modular MVVM library. It is part of the Windows Community Toolkit and is built around the following principles:
14
14
15
-
-**Platform and Runtime Independent** - **.NET Standard 2.0** 🚀 (UI Framework Agnostic)
15
+
-**Platform and Runtime Independent** - **.NET Standard 2.0**and **.NET 5**🚀 (UI Framework Agnostic)
16
16
-**Simple to pick-up and use** - No strict requirements on Application structure or coding-paradigms (outside of 'MVVM'ness), i.e., flexible usage.
17
17
-**À la carte** - Freedom to choose which components to use.
18
18
-**Reference Implementation** - Lean and performant, providing implementations for interfaces that are included in the Base Class Library, but lack concrete types to use them directly.
19
19
20
-
This package targets .NET Standard so it can be used on any app platform: UWP, WinForms, WPF, Xamarin, Uno, and more; and on any runtime: .NET Native, .NET Core, .NET Framework, or Mono. It runs on all of them. The API surface is identical in all cases, making it perfect for building shared libraries.
20
+
This package targets **.NET Standard** so it can be used on any app platform: UWP, WinForms, WPF, Xamarin, Uno, and more; and on any runtime: .NET Native, .NET Core, .NET Framework, or Mono. It runs on all of them. The API surface is identical in all cases, making it perfect for building shared libraries.
21
+
22
+
Additionally, the MVVM Toolkit also has a **.NET 5** target, which is used to enable more internal optimizations when running in on the .NET 5 runtime. The public API surface is identical in both cases, so NuGet will always resolve the best possible version of the package without consumers having to worry about which APIs will be available on their platform.
21
23
22
24
To install the package from within Visual Studio:
23
25
@@ -30,11 +32,12 @@ To install the package from within Visual Studio:
30
32
```c#
31
33
usingMicrosoft.Toolkit.Mvvm;
32
34
```
35
+
33
36
```vb
34
37
ImportsMicrosoft.Toolkit.Mvvm
35
38
```
36
39
37
-
3. Codesamplesareavailableintheotherdocspagesfor the MVVM package, and in the [unit tests](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/UnitTests/UnitTests.Shared/Mvvm) for the project.
40
+
3. Codesamplesareavailableintheotherdocspagesfor the MVVM Toolkit, and in the [unit tests](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/rel/7.1.0/UnitTests/UnitTests.Shared/Mvvm) for the project.
38
41
39
42
## When should I use this package?
40
43
@@ -43,28 +46,37 @@ Use this package for access to a collection of standard, self-contained, lightwe
Thispackageaimstoofferasmuchflexibilityaspossible, sodevelopersarefreetochoosewhichcomponentstouse. Alltypesareloosely-coupled, sothatit's only necessary to include what you use. There is no requirement to go "all-in" with a specific series of all-encompassing APIs, nor is there a set of mandatory patterns that need to be followed when building apps using these helpers. Combine these building blocks in a way that best fits your needs.
78
+
79
+
## Additional resources
80
+
81
+
-Checkoutthe [sampleapp](https://github.com/windows-toolkit/MVVM-Samples) (for multiple UI frameworks) to see the MVVM Toolkit in action.
Copy file name to clipboardExpand all lines: docs/mvvm/Ioc.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ A common pattern that can be used to increase modularity in the codebase of an a
13
13
14
14
The MVVM Toolkit doesn't provide built-in APIs to facilitate the usage of this pattern, as there already exist dedicated libraries specifically for this such as the `Microsoft.Extensions.DependencyInjection` package, which provides a fully featured and powerful DI set of APIs, and acts as an easy to setup and use `IServiceProvider`. The following guide will refer to this library and provide a series of examples of how to integrate it into applications using the MVVM pattern.
For more info about `Microsoft.Extensions.DependencyInjection`, see [here](https://docs.microsoft.com/aspnet/core/fundamentals/dependency-injection).
150
+
For more info about `Microsoft.Extensions.DependencyInjection`, see [here](/aspnet/core/fundamentals/dependency-injection).
151
151
152
152
## Examples
153
153
154
-
You can find more examples in the [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/UnitTests.Shared/Mvvm).
154
+
- Check out the [sample app](https://github.com/windows-toolkit/MVVM-Samples) (for multiple UI frameworks) to see the MVVM Toolkit in action.
155
+
- You can also find more examples in the [unit tests](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/rel/7.1.0/UnitTests/UnitTests.Shared/Mvvm).
0 commit comments