6
我用火MvxCommand with CommandParameter努力,但面临着以下问题: MyView.axml包含:使用MvxCommand随着CommandParameter结合
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1"
local:MvxBind="Click MyCommand, CommandParameter=foo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2"
local:MvxBind="Click MyCommand, CommandParameter=bar" />
</LinearLayout>
MyViewModel.cs:
public class MyViewModel : MvxViewModel
{
public ICommand MyCommand { get; private set; }
public MyViewModel()
{ // param is null
MyCommand = new MvxCommand<string>(param =>
{
if (param == "foo")
{
// do something
}
else if (param == "bar")
{
// do something else
}
});
}
}
但是当我检查param variable is null。
我在做什么错了?
你说的没错,司徒所需的
ValueConverter
仅仅是一个值转换器问题! 登录者观看需要: ** MvxBind:警告:132,54找不到命名转换CommandParameter I/MvxBind(18314):132,53找不到命名转换CommandParameter I /单标准输出(18314):MvxBind :警告:132,53找不到命名的转换器CommandParameter ** 何时可以预期最近的版本? –@Stuart我正在尝试相同的'本地:MvxBind =“点击OnRemoveClick,CommandParameter =。”'我得到相同的。“。同时执行commmand。有什么想法吗? – RIYAZ
对不起 - 听起来你没有像这个2013年的问题一样获得“相同”。可能是最好在一个新问题中完全解释你的问题? – Stuart