视图模型之间的 Xamarin mvmcross 选项卡导航
Xamarin mvmcross tab navigation between view models
我有两个链接到两个选项卡按钮的屏幕
- 姓名
- 持续时间
我希望在单击“下一步”按钮时将选项卡移动到第二个按钮。在我的视图模型中,这是我对 Next Button
的命令
这是我的代码示例
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
第一屏
第二屏
我看到的屏幕
在这种情况下,我不会使用 MvvmCross ViewModel 导航,因为要使用它,您可能必须创建自定义演示者。
您可以做的只是在 Activity 或 Fragment 本身中添加一个按钮点击并使用以下代码:
var viewPager = view.FindViewById<ViewPager>(Resource.Id.viewpager);
viewPager.SetCurrentItem(1, true);
我有两个链接到两个选项卡按钮的屏幕
- 姓名
- 持续时间
我希望在单击“下一步”按钮时将选项卡移动到第二个按钮。在我的视图模型中,这是我对 Next Button
的命令这是我的代码示例
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
第一屏
第二屏
我看到的屏幕
在这种情况下,我不会使用 MvvmCross ViewModel 导航,因为要使用它,您可能必须创建自定义演示者。
您可以做的只是在 Activity 或 Fragment 本身中添加一个按钮点击并使用以下代码:
var viewPager = view.FindViewById<ViewPager>(Resource.Id.viewpager);
viewPager.SetCurrentItem(1, true);