Can't pass a single parameter to lambda function in MVVM Light Toolkit's RelayCommand
- by Dave
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?