MvvmCross Xamarin.Forms模态对话框 [英] MvvmCross Xamarin.Forms Modal Dialogs

查看:324
本文介绍了MvvmCross Xamarin.Forms模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想用MvvmCross制作我的第一个应用程序,但是我的应用程序已经遇到问题,因此无法在网络上找到任何东西.我想在支持的设备(例如iPad)上打开特定页面作为模式对话框.对于我的非MvvmCross应用程序,我使用Rg.Plugin.Popup来执行此操作,但是这次我不希望这样做.我发现了一些有关如何使用本机和MvvmCross完成此操作的解决方案,但没有找到有关如何结合使用Xamarin.Forms和MvvmCross完成此操作的解决方案.我是否需要实现自己的演示者并根据页面的类型进行过滤(因为此页面在支持的设备上应该始终是模态的)?如果我这样做,是否有任何示例呢?

I'm just trying to make my first app with MvvmCross but I already encounter a problem for my app and can't find anything on the web for that. I want to open a specific page as a modal dialog on supported devices (eg. iPads). For my non MvvmCross applications I do this with Rg.Plugin.Popup but I do not want it this way this time. I found a few solutions on how it can be done with native and MvvmCross but nothing about how it is done with Xamarin.Forms in combination to MvvmCross. Did I need to implement a own presenter and filter on the type of my page (because this page should always be modal on supported devices)? And if I do so, is there any example for this?

推荐答案

使用MvvmCross 5.2.0,以下代码对我有效(至少在iOS上;尚未在Android上进行测试):

Using MvvmCross 5.2.0, the following worked for me (on iOS at least; haven't tested on Android):

var bundle = new MvxBundle(new Dictionary<string, string>{ { MvxFormsPagePresenter.ModalPresentationParameter, "true" } });
await _navService.Navigate<MyViewModel>(bundle);

这使用库存标准MvxFormsPagePresenter,因此您不必创建自己的演示者.

This uses the stock-standard MvxFormsPagePresenter, so you don't have to create your own presenter.

这篇关于MvvmCross Xamarin.Forms模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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