我有查看此VM的ViewModel和DialogFragment。 在覈心I顯示VM以這種方式綁定MvxDialogFragment與ViewModel
this.ShowViewModel<AnnotationEditViewModel>();
我在AnnotationEditDialogFragment.cs
[Register("AnnotationEditDialogFragment")]
public class AnnotationEditDialogFragment : MvxDialogFragment<AnnotationEditViewModel>
{
...
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
base.EnsureBindingContextSet(savedInstanceState);
var view = this.BindingInflate(Resource.Layout.text_annotation_dialog_fragment, null);
var titleAnnotationTextView = view.FindViewById<TextViewWithFont>(Resource.Id.titleAnnotationTextView);
var set = this.CreateBindingSet<AnnotationEditFragment, AnnotationEditViewModel>();
set.Bind(this).For(be => be.CanBeSaved).To(vm => vm.CanBeSaved);
set.Apply();
builder = new AlertDialog.Builder(Activity);
LayoutInflater inflater = Activity.LayoutInflater;
builder.SetView(view);
alertDialog = builder.Create();
return alertDialog;
}
...
}
我在Showv方法在MainPresenter請求,其中i可以檢測到這種請求該代碼。
如果MainPresenter我輸入驗證碼
var textAnnotationDialogFragment = Activity.FragmentManager.FindFragmentByTag(nameof(AnnotationEditFragment)) as AnnotationEditFragment ?? new AnnotationEditFragment();
textAnnotationDialogFragment.Show(Activity.FragmentManager, nameof(AnnotationEditFragment));
- 我看到對話框,但我沒有與VM/
結合,如果我鍵入ShowViewModel代碼() :
base.Show(request, fragmentRequest);
- 我得到錯誤沒有發現我的虛擬機有任何活動或片段/ 我怎樣纔能有綁定到虛擬機的對話框?