예제 #1
0
        /// <summary>
        ///   Note      Drawpopup
        /// </summary>

        public void Drawpopup()
        {
            _tempView   = Content;
            CenterPopup = new PopupInstanceLayout(this.Content, this, PageScroll);
            Content     = CenterPopup;

            RelativePopup = new PopupInstanceLayout(this.Content, this, PageScroll);
            Content       = RelativePopup;;
        }
예제 #2
0
        public void ShowInstacePopup(ContentView currentPage, PopupInstanceLayout currentLayout, View view, View relativeTo, double width, double height, bool modal, string title)
        {
            _tempCurrentPage    = currentPage;
            _tempCurrentLayout  = currentLayout;
            _tempContent        = currentPage.Content;
            currentPage.Content = currentLayout;

            _popupContent = view;
            _relativeTo   = relativeTo;
            _oheight      = height;
            _owidth       = width;
            PopupChanged  = false;
            _height       = _oheight + 16;
            _width        = _owidth;
            _isModal      = modal;
            _popupType    = PopupType.Relative;
            _title        = title;
            var points = this.GetXY(_relativeTo);

            DrawPopup(_popupContent, false, _title);
            if (_isModal)
            {
                _popupShield = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = new Color(0, 0, 0, 0.4)
                };
                //
                var tapToSheild = new TapGestureRecognizer();
                tapToSheild.Tapped += (s, e) => DismisPopup();
                _popupShield.GestureRecognizers.Add(tapToSheild);
                //
                SetLayoutFlags(_popupShield, AbsoluteLayoutFlags.None);
                Children.Add(_popupShield, new Rectangle(0, 0, _parentview.Width, _parentview.Height));

                //To handle popup visibility
                Task.Run(() => Task.Delay(100)).Wait();
            }

            SetLayoutFlags(_popupFramer, AbsoluteLayoutFlags.None);
            if (!PopupVisible)
            {
                SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, 0, 0));
            }

            Children.Add(_popupFramer);
            _triangleStack.Children.Insert(0, new StackLayout {
                BackgroundColor = Color.Transparent, WidthRequest = (GetX(relativeTo) - points.X) + (_relativeTo.Width / 2) - 10
            });

            if (!PopupVisible)
            {
                _popupFramer.LayoutTo(new Rectangle(points.X, points.Y, _width, _height), Device.OnPlatform <uint>(150, 50, 50), Easing.Linear);
                OnOpened();
            }
            else
            {
                SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, _width, _height));
            }

            PopupVisible = true;
        }