Microsoft.Windows.Controls.Ribbon.RibbonMenuButton.UpdateDropDownPosition C# (CSharp) Метод

UpdateDropDownPosition() приватный Метод

private UpdateDropDownPosition ( object arg ) : object
arg object
Результат object
        private object UpdateDropDownPosition(object arg)
        {
            if (!IsDropDownOpen)
            {
                return null;
            }

            UIElement popupChild = _popup.TryGetChild();
            if (popupChild != null)
            {
                Point targetTopLeftCorner;
                if (_popup.PlacementTarget != null)
                {
                    targetTopLeftCorner = _popup.PlacementTarget.PointToScreen(new Point());
                }
                else
                {
                    targetTopLeftCorner = this.PointToScreen(new Point());
                }
                Point popupBottomRightCorner = popupChild.PointToScreen(new Point(popupChild.RenderSize.Width, popupChild.RenderSize.Height));

                IsDropDownPositionedAbove = DoubleUtil.LessThanOrClose(popupBottomRightCorner.Y, targetTopLeftCorner.Y);
                if (IsDropDownPositionedAbove)
                {
                    // Anchor the popup so that its position doesnt change when resizing.
                    _popup.Placement = PlacementMode.Top;
                }
            }

            // Cache the screen bounds of the monitor in which the dropdown is opened
            _screenBounds = RibbonDropDownHelper.GetScreenBounds(_itemsPresenter, _popup);

            // Also cache the PopupRoot if opened for the first time
            if (_popupRoot == null && _itemsPresenter != null)
            {
                _popupRoot = TreeHelper.FindVisualRoot(_itemsPresenter) as UIElement;
            }
            return null;
        }