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