private void FButton_Click(object sender, RoutedEventArgs e)
        {
            PopupTemplate win = new PopupTemplate();

            win.PopupContext.Source = new Uri("../Popup/Pages/MainPagePopup.xaml", UriKind.Relative);
            win.ShowDialog();
        }
Example #2
0
        /// <summary>
        /// Create and open drop down popup
        /// </summary>
        private void OpenDropDown()
        {
            // Create popup if not created
            if (_popup == null)
            {
                _popup                    = new Popup();
                _popup.Placement          = PopupPlacements.BottomLeft;
                _popup.PlacementTarget    = this;
                _popup.Spacing            = PopupSpacing;
                _popup.Style              = PopupStyle;
                _popup.HasModalBackground = false;
                _popup.IsOpenChanged     += OnPopupIsOpenedChanged;
                _popup.AnimationFinished += OnPopupIsOpenAnimationFinished;
            }

            SKRect borderLocation = GetBorderLocation();

            _popup.PlacementRectangle = new Rectangle(
                borderLocation.Left / DeviceScale,
                borderLocation.Top / DeviceScale,
                borderLocation.Width / DeviceScale,
                borderLocation.Height / DeviceScale);

            if (IsFullScreen())
            {
                _popup.Placement          = PopupPlacements.FullScreen;
                _popup.CornerRadius       = 0;
                _popup.ShadowLenght       = 0;
                _popup.BorderThickness    = 1;
                _popup.BackgroundColor    = Color.White;
                _popup.HasModalBackground = true;

                if (_fullScreenPopupContent == null)
                {
                    _fullScreenPopupContent = FullScreenPopupTemplate.CreateContent() as View;
                }

                InitializePopup(_fullScreenPopupContent);

                if (_popup.Content != _fullScreenPopupContent)
                {
                    _popup.Content = _fullScreenPopupContent;
                }
            }
            else
            {
                _popup.Placement = PopupPlacements.BottomLeft;

                if (_popupContent == null)
                {
                    _popupContent = PopupTemplate.CreateContent() as View;
                }

                InitializePopup(_popupContent);

                _popupContent.WidthRequest = Width;

                if (_popup.Content != _popupContent)
                {
                    _popup.Content = _popupContent;
                }
            }

            _popup.IsOpen = true;
        }