Microsoft.Toolkit.Mvvm.Input Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Classes
AsyncRelayCommand |
A command that mirrors the functionality of RelayCommand, with the addition of accepting a Func<TResult> returning a Task as the execute action, and providing an ExecutionTask property that notifies changes when ExecuteAsync(Object) is invoked and when the returned Task completes. |
AsyncRelayCommand<T> |
A generic command that provides a more specific version of AsyncRelayCommand. |
ICommandAttribute |
An attribute that can be used to automatically generate ICommand properties from declared methods. When this attribute is used to decorate a method, a generator will create a command property with the corresponding IRelayCommand interface depending on the signature of the method. If an invalid method signature is used, the generator will report an error. In order to use this attribute, the containing type doesn't need to implement any interfaces. The generated properties will be lazily assigned but their value will never change, so there is no need to support property change notifications or other additional functionality. This attribute can be used as follows:
And with this, code analogous to this will be generated:
The following signatures are supported for annotated methods:
Will generate an IRelayCommand property (using a RelayCommand instance).
Will generate an IRelayCommand<T> property (using a RelayCommand<T> instance).
Will both generate an IAsyncRelayCommand property (using an AsyncRelayCommand<T> instance).
Will both generate an IAsyncRelayCommand<T> property (using an AsyncRelayCommand<T> instance). |
RelayCommand |
A command whose sole purpose is to relay its functionality to other
objects by invoking delegates. The default return value for the CanExecute(Object)
method is |
RelayCommand<T> |
A generic command whose sole purpose is to relay its functionality to other
objects by invoking delegates. The default return value for the CanExecute
method is |
Interfaces
IAsyncRelayCommand |
An interface expanding IRelayCommand to support asynchronous operations. |
IAsyncRelayCommand<T> |
A generic interface representing a more specific version of IAsyncRelayCommand. |
IRelayCommand |
An interface expanding ICommand with the ability to raise the CanExecuteChanged event externally. |
IRelayCommand<T> |
A generic interface representing a more specific version of IRelayCommand. |