Xamarin.Forms.Command Class
Defines an System.Windows.Input.ICommand implementation wrapping an stem.Action.

See Also: Command Members

Syntax

public class Command : System.Windows.Input.ICommand

Remarks

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

C# Example

var command = new Command (() => Debug.WriteLine ("Command executed"));
var button = new Button {
  Text = "Hit me to execute the command",
  Command = command,
};

More useful scenarios takes a parameter

C# Example

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

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0