nfloat GetVerticalPosition(CGRect presentedViewFrame) { var containerFrame = ContainerView.Bounds; if (_dlgView.UseCurrentPageLocation) { containerFrame = Dialogs.GetCurrentPageRect(ContainerView); } switch (_dlgView.VerticalLayoutAlignment) { case Xamarin.Forms.LayoutAlignment.Start: return(containerFrame.Top); case Xamarin.Forms.LayoutAlignment.End: return((nfloat)(containerFrame.Bottom - _dlgView.Bounds.Height)); default: return(containerFrame.Size.Height / 2f - presentedViewFrame.Size.Height / 2f + containerFrame.Top); } }