简体   繁体   English

Xamarin Forms:如何切换ViewModels?

[英]Xamarin Forms: How to switch ViewModels?

Switched to Forms from MvvmCross (mvx). 从MvvmCross(mvx)切换到表单。 With Mvx, in the ViewModel code, I use ShowViewModel<MainViewModel>() to switch. 对于Mvx,在ViewModel代码中,我使用ShowViewModel<MainViewModel>()进行切换。 How do I do that with Xamarin Forms? 如何使用Xamarin Forms做到这一点?
Note: I don't want to add any code in the code-behind file. 注意:我不想在代码隐藏文件中添加任何代码。

Xamarin.Forms is not an Mvvm library. Xamarin.Forms 不是 Mvvm库。 It's a cross platform mobile development toolkit. 这是一个跨平台的移动开发工具包。 If you choose to go Mvvm , it's totally supported (and encouraged) by Xamarin.Forms , and you're free to pick any Mvvm framework you want. 如果您选择使用Mvvm ,则Mvvm完全支持(鼓励) Xamarin.Forms ,您可以自由选择想要的任何Mvvm框架。 Hopefully those framework will provide to navigate between ViewModels in one way or the other. 希望那些框架能够以一种或另一种方式在ViewModels之间导航。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM