Exemple #1
0
        public void Update(PopupPositionerParameters parameters)
        {
            // Simplify calculations
            var horizontalMargin = (parameters.AnchorRectangle.Width - parameters.Size.Width) / 2;
            var verticalMargin   = (parameters.AnchorRectangle.Height - parameters.Size.Height) / 2;

            _popup.MoveAndResize(new Point(horizontalMargin, verticalMargin), parameters.Size / _popup.Scaling);
        }
Exemple #2
0
        /// <summary>
        /// Show the PopupWindow at the specified screen coordinates
        /// </summary>
        public void Show(int x, int y)
        {
            var point = parent_form.PointToClient(new Point(x, y));

            var ppp = new PopupPositionerParameters {
                AnchorRectangle      = new WindowKit.Rect(point.X, point.Y, 1, 1),
                Anchor               = PopupAnchor.TopLeft,
                Gravity              = PopupGravity.BottomRight,
                ConstraintAdjustment = PopupPositionerConstraintAdjustment.All,
                Size = Size.ToAvaloniaSize()
            };

            PopupImpl.PopupPositioner.Update(ppp);

            Show();
        }