Command<T> 类

定义

定义包含泛型 Action<T> 的 System.Windows.Input.ICommand 实现。

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

类型参数

T

参数的类型,

继承
System.Object
Command<T>

注解

以下示例创建一个新的命令,并将其设置为按钮。

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",
};

构造函数

Command<T>(Action<T>)

初始化 Command 类的新实例。

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

初始化 Command 类的新实例。

方法

CanExecute(Object)

返回一个 System.Boolean,指示是否能使用给定的参数执行命令。

(继承自 Command)
ChangeCanExecute()

发送 System.Windows.Input.ICommand.CanExecuteChanged

(继承自 Command)
Execute(Object)

调用执行操作

(继承自 Command)

事件

CanExecuteChanged

在命令的目标需重新评估是否可执行该命令时发生。

(继承自 Command)

适用于