1

I have a modal dialog that I show using the following code:

private void ShowUpdateDialog(float version, bool breakingChanges, string hint, string storeLink, string changelog, params string[] pars)
    {
        var dialog = new UpdatePopupController(this, new RectangleF(20, 20, 550, 600));
        dialog.WantsFullScreenLayout = true;
        dialog.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
        dialog.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
        dialog.ModalInPopover = true;
        UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
        dialog.ShowData(version, breakingChanges, hint, storeLink, changelog, pars);
        dialog.WillRotate(UIApplication.SharedApplication.StatusBarOrientation, 0);
        NavigationController.PresentModalViewController(dialog, true);
        dialog.BecomeFirstResponder();
    }

I get this result (that is what I expected):

Modal dialog showing

Now I want to implement closing the dialog by taping out of the gray content of the dialog. How can I do it? The dialog itself inherits from UIViewController.

Scarlaxx
  • 835
  • 1
  • 6
  • 13
  • The solution in the accepted answer doesn't work on iOS 11.2 with Xamarin.Forms 2.5.0, have you that approach recently? – rraallvv Feb 12 '18 at 16:10

2 Answers2

2

Dont make it Modal. Then it works

dialog.ModalInPopover = false;
Sascha
  • 36
  • 2
1

See this question which asks the same thing.

Personally I would have a button which upon TouchDown would dismiss the modal view.

Community
  • 1
  • 1
Luke
  • 3,665
  • 1
  • 19
  • 39
  • Sure I can add a button. But I'd prefer to achieve the functionality that you have i.e. under details view of a prodcast in iTunes. – Scarlaxx May 04 '11 at 14:36