MvvmCross Xamarin.Forms Modal Dialogs

2019-07-12 17:59发布

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?

1条回答
劳资没心,怎么记你
2楼-- · 2019-07-12 18:38

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);

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

查看更多
登录 后发表回答