예제 #1
0
        protected override void OnClose()
        {
            if (!IsOpen)
            {
                return;
            }

            Popup.IsOpen = false;
            ItemCoordinator.OnMenuVisibilityChanged();
            Popup.Content = null;

            if (_closed != null)
            {
                _closed(this, EventArgs.Empty);
            }
        }
예제 #2
0
        private void Open()
        {
            if (!HasItems || IsOpen)
            {
                return;
            }

            this.IsTabStop = true;

            Popup.Content = this;
            UpdateLayout();

            var strategy = MenuPositioningStrategy;

            if (strategy != null)
            {
                strategy.BeforeOpenPopup(this, Popup);
            }

            Popup.IsOpen = true;
            this.Focus();

            ItemCoordinator.OnMenuVisibilityChanged();

            UpdateLayout();

            if (strategy != null)
            {
                strategy.AfterOpenPopup(this, Popup);
            }

            if (_opened != null)
            {
                _opened(this, EventArgs.Empty);
            }
        }