【问题标题】:Using a parameter with Catel Command通过 Catel 命令使用参数
【发布时间】:2014-01-20 23:36:18
【问题描述】:

我尝试在 Catel 的命令中使用参数:

public Command MyCommand { get; private set; }

MyCommand = new Command(MyCommand_Execute);

private void MyCommand_Execute(object parameter)
{
}

并得到以下错误:

最好的重载方法匹配 'Catel.MVVM.Command.Command(System.Action,System.Func,对象)' 有一些无效的参数

我遵循了示例 Catel 代码,有什么想法吗?

【问题讨论】:

  • 我发现如果我使用 Commmand,我可以让它工作。

标签: wpf command catel


【解决方案1】:

用实际答案来终结这个问题:

使用Command类的通用实现,即Command:

public Command<int> MyCommand { get; private set; }

MyCommand = new Command<int>(MyCommand_Execute);

private void MyCommand_Execute(int parameter)
{
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-29
    • 2016-07-02
    • 2021-12-13
    • 1970-01-01
    • 2017-11-20
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    相关资源
    最近更新 更多