视图模型之间Xamarin mvmcross标签导航 [英] Xamarin mvmcross tab navigation between view models
问题描述
我有两个这是与两个标签按钮屏幕
- 名称
- 持续时间
我想选项卡,转到第二个按钮,当我点击下一步按钮。在我看来,模型,这是我的命令下一个按钮
下面是我的code样品
公共IMvxCommand NextCommand
{
得到
{
返回新MvxCommand(()=> ShowViewModel&下; RecyclerViewModel>());
}
}
而不是标签移动到下一个选项卡第二种观点完全是开放
屏幕。
屏幕连接
块引用>第一个屏幕
第二个屏幕
画面我看到
解决方案我这个情况我不会用MvvmCross视图模型导航,因为使用您可能要创建一个自定义presenter。
你可以做的只是增加一个按钮点击活动或片段本身并使用以下code:
VAR viewPager = view.FindViewById< ViewPager>(Resource.Id.viewpager);
viewPager.SetCurrentItem(1,真);I have two screens which are linked to two tab buttons
- Name
- Duration
I would like tab to move to second button when I click Next button. In my view model this is my command for Next Button
Here is my code sample
public IMvxCommand NextCommand { get { return new MvxCommand(() => ShowViewModel<RecyclerViewModel>()); } }
Rather than tab moving to next tab second view is opening in full screen.
Screens attached
First screen
Second screen
Screen I am seeing
解决方案I this situation i would not use the MvvmCross ViewModel navigation, because to use that you probably have to create a custom presenter.
What you can do is just add a button click in the Activity or Fragment itself and use the following code:
var viewPager = view.FindViewById<ViewPager>(Resource.Id.viewpager); viewPager.SetCurrentItem(1, true);
这篇关于视图模型之间Xamarin mvmcross标签导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!