Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

RelayCommand<T> Class

Definition

Namespace:
Microsoft.Toolkit.Mvvm.Input
Assembly:
Microsoft.Toolkit.Mvvm.dll
Package:
Microsoft.Toolkit.Mvvm v7.0.2
Package:
Microsoft.Toolkit.Mvvm v7.1.2
Source:
RelayCommand%7BT%7D.cs
Source:
RelayCommand%7BT%7D.cs

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.

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> : Microsoft.Toolkit.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