Display Name
Display Name

Reputation: 1035

Xamarin.Froms MVVMCross loading modal view

My team have been struggling with this for few days. We are porting a swift app over to Xamarin.Forms using MVVMCross (This is our first play with Xamarin.Forms)

Our app consists of 4 main viewcontrollers and we have numerous modals views that appear as a 'FormSheet' (so they appear NOT full screen and can be sized). In swift we embed each modal view within a navigation controller.

We are struggling how to do this behaviour in Xamarin.Forms

We have created our main view controllers and can switch using

await _navigationService.Navigate<...ViewModel>();

What we can't do is either load the modal view (so they appear as modal view) or load the view in a new navigation window (again as a modal view)

Upvotes: 0

Views: 290

Answers (1)

FabriBertani
FabriBertani

Reputation: 1636

In order to open a page as a modal you must add the attribute to forms page on code behind

[MvxModalPresentation(WrapInNavigationPage = false)]
public partial class YourModalView : MvxContentPage<YourModalViewModel>

I would highly recommend you to check the presentation attributes from MvvmCross for Xamarin.Forms

Upvotes: 1

Related Questions