Exemplo n.º 1
0
        public static void UpdateSize(this PopupPageRenderer renderer)
        {
            var currentElement = renderer.CurrentElement;

            if (renderer.View?.Superview?.Frame == null || currentElement == null)
            {
                return;
            }

            var superviewFrame  = renderer.View.Superview.Frame;
            var applactionFrame = NSScreen.MainScreen.Frame;

            var systemPadding = new Thickness
            {
                Left   = applactionFrame.Left,
                Top    = applactionFrame.Top,
                Right  = applactionFrame.Right - applactionFrame.Width - applactionFrame.Left,
                Bottom = applactionFrame.Bottom - applactionFrame.Height - applactionFrame.Top
            };

            currentElement.BatchBegin();

            currentElement.SystemPadding = systemPadding;
            renderer.SetElementSize(new Size(superviewFrame.Width, superviewFrame.Height));

            currentElement.BatchCommit();
        }
        public static void UpdateSize(this PopupPageRenderer renderer)
        {
            var currentElement = renderer.CurrentElement;

            if (renderer.View?.Superview?.Frame == null || currentElement == null)
            {
                return;
            }

            var superviewFrame   = renderer.View.Superview.Frame;
            var applicationFrame = UIScreen.MainScreen.ApplicationFrame;

            var systemPadding = new Thickness
            {
                Left   = applicationFrame.Left,
                Top    = applicationFrame.Top,
                Right  = applicationFrame.Right - applicationFrame.Width - applicationFrame.Left,
                Bottom = applicationFrame.Bottom - applicationFrame.Height - applicationFrame.Top + renderer.KeyboardBounds.Height
            };

            if ((renderer.Element.Width != superviewFrame.Width && renderer.Element.Height != superviewFrame.Height) ||
                currentElement.SystemPadding.Bottom != systemPadding.Bottom)
            {
                currentElement.BatchBegin();
                currentElement.SystemPadding = systemPadding;
                renderer.SetElementSize(new Size(superviewFrame.Width, superviewFrame.Height));
                currentElement.BatchCommit();
            }
        }