I\'m trying using fire MvxCommand with CommandParameter, but faced with following problem: MyView.axml contains:
I was doing CommandParameter coding today and you need to do couple of fixes. The axml code should contain CommandParameter='yourParameter' it looks like this:
Even if you want to catch an Integer you still need to pass this in single quotation marks as this: CommandParameter='1234'
In C# code the most important thing is remove MvxCommand from constructor. This should be treated as Property.
public class MyViewModel : MvxViewModel
{
public MyViewModel() { }
public MvxCommand MyCommand
{
get
{
return new MvxCommand(param =>
{
if (param == "foo")
{
// do something
}
else if (param == "bar")
{
// do something else
}
});
}
}
}
This was done in MvvmCross6. It should work fine with previous versions.