我在 xamarin iOS 上使用 MvvmCross。我在 ViewModel 和 json 上使用 fluent 进行绑定。我想尝试 WithFallback() 函数,但是当我的 ViewModel 上的属性(在本例中为字符串)为 null 或为空时,它什么也不做。我试过这个:
//This works
this.BindLanguage(Header1, "Title");
/* This works when vm.Message is not null or empty,
/* else print nothing, but don't call the WithFallback function
*/
set.Bind(myLbl).For(view => view.Text).To(vm => vm.Message).WithFallback("Something");
set.Apply();
另一个问题是我如何将该回退与 viewmodel 或 json 的属性绑定。非常感谢!