Command<T> Class
Definition
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.
Defines an System.Windows.Input.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
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 System.Boolean indicating if the Command can be exectued with the given parameter. (Inherited from Command) |
ChangeCanExecute() |
Send a System.Windows.Input.ICommand.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) |