Пример #1
0
        public IXFPopupCtrl CreateDialog(Xamarin.Forms.Page page, Xamarin.Forms.View content, bool cancelable)
        {
            CustomDialog dlg = null;

            if (content != null)
            {
                var render = Convert(content, page);

                if (render != null)
                {
                    var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT);

                    var width  = (int)size.Request.Width;
                    var height = (int)size.Request.Height;


                    if (width > XFPopupConst.SCREEN_WIDTH)
                    {
                        width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4);
                    }

                    if (height > (XFPopupConst.SCREEN_HEIGHT * 3 / 4))
                    {
                        height = (int)(XFPopupConst.SCREEN_HEIGHT * 3 / 4);
                    }

                    content.WidthRequest  = width;
                    content.HeightRequest = height;

                    //important
                    content.Layout(new Rectangle(0, 0, width, height));

                    dlg = new CustomDialog(content, cancelable);
                }
            }
            return(dlg);
        }
Пример #2
0
        public IXFPopupCtrl CreateDialog(Xamarin.Forms.Page page, Xamarin.Forms.View content, bool cancelable)
        {
            CustomDialog dlg = null;

            if (content != null)
            {

                var render = Convert(content, page);

                if (render != null)
                {

                    var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT);

                    var width = (int)size.Request.Width;
                    var height = (int)size.Request.Height;

                    if (width > XFPopupConst.SCREEN_WIDTH)
                    {
                        width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4);
                    }

                    if (height > (XFPopupConst.SCREEN_HEIGHT * 3 / 4))
                    {
                        height = (int)(XFPopupConst.SCREEN_HEIGHT * 3 / 4);
                    }

                    content.WidthRequest = width;
                    content.HeightRequest = height;

                    //important
                    content.Layout(new Rectangle(0, 0, width, height));

                    dlg = new CustomDialog(content, cancelable);

                }

            }
            return dlg;
        }