Edit

Share via


RelayCommandAttribute.IncludeCancelCommand Property

Definition

Gets or sets a value indicating whether a cancel command should also be generated for an asynchronous command.

When set to true, this additional code will be generated:

partial class MyViewModel
{
    private ICommand? loginUserCancelCommand;

    public ICommand LoginUserCancelCommand => loginUserCancelCommand ??= LoginUserCommand.CreateCancelCommand();
}

Where LoginUserCommand is an IAsyncRelayCommand defined in the class (or generated by this attribute as well).

public bool IncludeCancelCommand { get; init; }
member this.IncludeCancelCommand : bool with get, set
Public Property IncludeCancelCommand As Boolean

Property Value

Remarks

Using this property is not valid if the target command doesn't map to a cancellable asynchronous command.

Applies to