Edit

Share via


RelayCommand<T> Class

Definition

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 true. This class allows you to accept command parameters in the Execute(T) and CanExecute(T) callback methods.

public sealed class RelayCommand<T> : CommunityToolkit.Mvvm.Input.IRelayCommand<T>, System.Windows.Input.ICommand
type RelayCommand<'T> = class
    interface IRelayCommand<'T>
    interface IRelayCommand
    interface ICommand
Public NotInheritable Class RelayCommand(Of T)
Implements ICommand, IRelayCommand(Of T)

Type Parameters

T

The type of parameter being passed as input to the callbacks.

Inheritance
RelayCommand<T>
Implements

Constructors

RelayCommand<T>(Action<T>, Predicate<T>)

Initializes a new instance of the RelayCommand<T> class.

RelayCommand<T>(Action<T>)

Initializes a new instance of the RelayCommand<T> class that can always execute.

Methods

CanExecute(Object)
CanExecute(T)
Execute(Object)
Execute(T)
NotifyCanExecuteChanged()

Notifies that the CanExecute(Object) property has changed.

Events

CanExecuteChanged

Applies to