Can't pass a single parameter to lambda function in MVVM Light Toolkit's RelayCommand
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-06-07T03:50:40Z
Indexed on
2010/06/07
3:52 UTC
Read the original article
Hit count: 445
I don't know if there's a difference between Josh Smith's and Laurent Bugnion's implementations of RelayCommand or not, but everywhere I've looked, it sounds like the Execute portion of RelayCommand can take 0 or 1 parameters. I've only been able to get it to work with 0. When I try something like:
public class Test
{
public RelayCommand MyCommand { get; set; }
public Test()
{
MyCommand = new RelayCommand((param) => SomeFunc(param));
}
private void SomeFunc( object param)
{
}
}
I get the error: Delegate 'System.Action' does not take '1' arguments
. Just to make sure I am not insane, I went to the definition of RelayCommand to make sure I didn't have some rogue implementation in my solution somewhere, but sure enough, it was just Action, and not Action<>.
What on earth am I missing here?
© Stack Overflow or respective owner