Command<T> Class

Definition

Defines an ICommand implementation wrapping a generic Action<T>.

public sealed class Command<T> : Xamarin.Forms.Command
type Command<'T> = class
    inherit Command

Type Parameters

T

The Type of the parameter,

Inheritance
Command<T>

Remarks

The following example creates a new Command and sets it to a button.

var command = new Command<string> (s => Debug.WriteLine ("Command executed: {0}", s));
var button = new Button {
  Text = "Hit me to execute the command",
  Command = command,
  CommandParameter = "button0",
};

Constructors

Command<T>(Action<T>)

Initializes a new instance of the Command class.

Command<T>(Action<T>, Func<T,Boolean>)

Initializes a new instance of the Command class.

Methods

CanExecute(Object)

Returns a Boolean indicating if the Command can be exectued with the given parameter.

(Inherited from Command)
ChangeCanExecute()

Send a CanExecuteChanged

(Inherited from Command)
Execute(Object)

Invokes the execute Action

(Inherited from Command)

Events

CanExecuteChanged

Occurs when the target of the Command should reevaluate whether or not the Command can be executed.

(Inherited from Command)

Applies to