Esempio n. 1
0
        public void ShowPopup()
        {
            if (PopupLayoutEngine == null)
            {
                PopupLayoutEngine = new PopupLayoutEngine(this.PopupContent, this, this.PopDirection, 0, this.AlignToRightEdge);
            }
            menuVisible = true;

            this.PopupContent?.ClearRemovedFlag();

            if (this.DynamicPopupContent != null)
            {
                this.PopupContent = this.DynamicPopupContent();
            }

            if (this.PopupContent == null ||
                this.PopupContent.Children.Count <= 0)
            {
                menuVisible = false;
                return;
            }

            this.OnBeforePopup();

            popupWidget = new PopupWidget(this.PopupContent, PopupLayoutEngine, MakeScrollable)
            {
                BorderWidth = 1,
                BorderColor = this.PopupBorderColor,
            };

            popupWidget.Closed += (s, e) =>
            {
                menuVisible = false;
                popupWidget = null;

                this.PopupWindowClosed?.Invoke(this, null);
            };

            ConfigurePopup?.Invoke(this, popupWidget);

            popupWidget.Focus();
        }