2015-07-22 72 views

回答

2

這是可能的使用標準MvvmCross代碼。對於視圖模型,你可以使用類似:

public class SomeViewModel : MvxViewModel 
{ 
    public IMvxCommand OpenSomethingCommand { get; private set; } 

    public SomeViewModel() 
    { 
     OpenSomethingCommand = new MvxCommand(() => ShowViewModel<SomeOtherNewViewModel>()); 
    } 
} 

然後在你的Android項目的佈局,你可以使用:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:clickable="true" 
    local:MvxBind="Click OpenSomethingCommand" 
    android:id="@+id/someLayout"> 
//Wrap any other layouts in here 
</RelativeLayout> 
+0

我如何綁定onclick事件的佈局,是爲viewpager孩子? – GvSharma