Note

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

Access to this page requires authorization. You can try .

RelayCommand 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.cs
Source:
RelayCommand.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 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 true. This type does not allow you to accept command parameters in the Execute(Object) and CanExecute(Object) callback methods.

public sealed class RelayCommand : Microsoft.Toolkit.Mvvm.Input.IRelayCommand, System.Windows.Input.ICommand
type RelayCommand = class
 interface IRelayCommand
 interface ICommand
Public NotInheritable Class RelayCommand
Implements ICommand, IRelayCommand
Inheritance
RelayCommand
Implements

Constructors

RelayCommand(Action, Func<Boolean>)

Initializes a new instance of the RelayCommand class.

RelayCommand(Action)

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

Methods

CanExecute(Object)
Execute(Object)
NotifyCanExecuteChanged()

Notifies that the CanExecute(Object) property has changed.

Events

CanExecuteChanged

Applies to