0
在FundamentalView.cs,我有點擊事件觸發從視圖的底部有選項(添加一個新的人和新的計算)的片段。ViewModel在MVVMCross中沒有被調用
var addButton = view.FindViewById<ImageButton>(Resource.Id.addButton);
addButton.Click += OnAddButtonClick;
void OnAddButtonClick(object sender, System.EventArgs e)
{
var dialog = new CardDialogView();
dialog.Show(((MainView)Activity).SupportFragmentManager, "CardDialogView");
}
CardDialogView.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/dash_add_computer"
android:textColor="@color/primary_text"
android:textSize="16sp"
android:text="New Calculation"
local:MvxBind="Click NewCalculationCommand"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/dash_add_head"
android:drawablePadding="28dp"
android:textColor="@color/primary_text"
android:textSize="16sp"
android:text="New Person" />
</LinearLayout>
CardDialogView.cs
public class CardDialogView : MvxDialogFragment<CardDialogViewModel>
{
public override Dialog OnCreateDialog(Bundle savedState)
{
......
return dialog ;
}
}
以下相應的視圖模型不會被調用?我不知道我錯過了什麼?
CardDialogViewModel.cs
public class CardDialogViewModel : MvxViewModel
{
public ICommand NewCalculationCommand
{
get
{
return new MvxCommand(() => ShowViewModel<NewItemViewModel>(new { date = DateTime.Now }));
}
}
}
我已經添加了,卻忘了在我的問題,這是行不通的 – hotspring
阿涼吼聲,從而它probs難道不建,什麼版本包括MVVMCross您正在使用? –
我正在使用4.0版 – hotspring