ICommand方法执行参数值 [英] ICommand method execute parameter value

查看:360
本文介绍了ICommand方法执行参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从wpf了解ICommand.

I try to understand the ICommand from wpf.

在我的Event类中,我实现了ICommand及其方法.

In my Event class I implement the ICommand and their methods.

一种方法是Execute:

one method is the Execute:

public void Execute(object parameter)
{
    //Do something
}

现在是我的问题:什么值包含Execute中的参数parameter?

now is my question: what value contains the parameter parameter from Execute?

推荐答案

该值取决于您传递到命令的值.

That value depends on the value you pass to the command.

像摘要一样

Command="{Binding CalculateCommand}" CommandParameter="LCM"/>

查看此处:带有参数传递的命令绑定了解更多信息.

Look here: Command Binding with Parameter Passing for more details.

这篇关于ICommand方法执行参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆