共用方式為


DelegateCommand<T> Class

Definition

Implementation of ICommand where the Execute and CanExecute callbacks are handled by delegates.

generic <typename T>
public ref class DelegateCommand : Microsoft::VisualStudio::PlatformUI::DelegateCommandBase, System::Windows::Input::ICommand
public class DelegateCommand<T> : Microsoft.VisualStudio.PlatformUI.DelegateCommandBase, System.Windows.Input.ICommand
type DelegateCommand<'T> = class
    inherit DelegateCommandBase
    interface ICommand
Public Class DelegateCommand(Of T)
Inherits DelegateCommandBase
Implements ICommand

Type Parameters

T

The parameter type for the Execute and CanExecute delegates

Inheritance
DelegateCommand<T>
Derived
Implements

Constructors

DelegateCommand<T>(Action<T>)

Initializes a new instance of the DelegateCommand<T> class. Using this constructor to initialize the DelegateCommand results in a command that can always execute.

DelegateCommand<T>(Action<T>, JoinableTaskFactory)

Initializes a new instance of the DelegateCommand<T> class. Using this constructor to initialize the DelegateCommand results in a command that can always execute.

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

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

DelegateCommand<T>(Action<T>, Predicate<T>, JoinableTaskFactory)

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

Methods

CanExecute(Object)

Gets a value indicating whether this command is executable.

CanExecuteDependsOn(INotifyPropertyChanged, String)

Adds a property upon which this command's CanExecute state depends. When the property changes, this command will raise CanExecuteChanged

(Inherited from DelegateCommandBase)
Execute(Object)

Executes the command.

RaiseCanExecuteChanged()

Raises the CanExecuteChanged event.

(Inherited from DelegateCommandBase)

Events

CanExecuteChanged

An event that is fired when the executable state of this command changes. Call RaiseCanExecuteChanged to force listeners to update.

(Inherited from DelegateCommandBase)

Applies to