如何将无形的视图模型添加到导航堆栈中MvvmCross [英] How to add an invisible ViewModel to the Navigation Stack in MvvmCross

查看:91
本文介绍了如何将无形的视图模型添加到导航堆栈中MvvmCross的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的应用情况。
在启动时我想去列表视图模型作为启动视图模型/视图。
,但我希望用户能够返回到跳转选择菜单视图模型。
这将如何在MvvmCross做?

I have the following app situation. At startup I want to go to the "List"ViewModel as a startup viewmodel/view. But I want the user to be able to choose BACK to goto the "Menu"ViewModel. How would this be done in MvvmCross?

推荐答案

如果你想支持WP7,那么导航将很难通过市场提交流程让 - 倒流是WP7神圣

If you ever want to support WP7, then that navigation will struggle to get through the marketplace submission process - the back flow is sacred on wp7.

这流程也不会作出这样的Android或iPhone用户太大的意义要么...所以你可能会更好考虑替代UX流 - 你仍然可以有流动ListView->菜单 - > ...但你可以避开BACK语法用户理解为BACK

That flow also doesn't make that much sense for Android or iPhone users either... so you might be better considering an alternative UX flow - you can still have the flow ListView->Menu->... but you can avoid "BACK" syntax that users understand as BACK.

我想我会实现这个类型UX为:

I think I'd implement this type of UX as:

在启动时导航到ListView / 。ListViewModel通常

On startup navigate to the ListView/ListViewModel normally.

目前一些方式 - 菜单,按钮或超链接 - 让用户导航到HomeView / HomeViewModel - 但尝试使用家或菜单的比喻,而不是背一 - 后指背特别是在WP7

Present some way - a menu, button, or hyperlink - to let the user to navigate to HomeView/HomeViewModel - but try to use a "home" or "menu" metaphor rather than a "back" one - "back means back" especially on WP7.

在导航首页,在设置标志为ClearTop导航 - 例如:

In the navigation to Home, set the flag for "ClearTop" in the navigation - e.g.:

public IMvxCommand GoHomeCommand
{
    get
    {
        return new MvxRelayCommand(RequestNavigate<HomeViewModel>(true));
    }
}

这ClearTop标志将被iOS的解释和WP7清除导航返回堆栈一旦你达到家庭。然而,遗憾的是它并不完美目前Android中的工作 - 所以你需要做一些聪明的在你的Android UI项目 - 例如也许某种方式找到一种方法,使用NoHistory标志的特别启动的ListView /活动。

This "ClearTop" flag will be interpreted by iOS and WP7 to clear the navigation back stack once you reach Home. However, sadly it doesn't currently work perfectly in Android - so you'll need to do something clever in your Android UI project - e.g. maybe somehow find a way to use the "NoHistory" flag for the special start ListView/Activity.

有兴趣听到的话,有这样做的其他方式。

Interested to hear if there are other ways of doing this.

这篇关于如何将无形的视图模型添加到导航堆栈中MvvmCross的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆