See Also: Command Members
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",
};