static double ArrangeChild(IView child, int spacing, double x)
        {
            var destination = new Rectangle(x, 0, child.DesiredSize.Width, child.DesiredSize.Height);

            child.Arrange(destination);
            return(destination.Width + spacing);
        }
示例#2
0
        static double ArrangeChildFromLeftEdge(IView child, double height, double top, double x)
        {
            var destination = new Rect(x, top, child.DesiredSize.Width, height);

            child.Arrange(destination);
            return(destination.Width);
        }
示例#3
0
        static double ArrangeChildFromRightEdge(IView child, double height, double top, double x)
        {
            var width       = child.DesiredSize.Width;
            var destination = new Rect(x - width, top, width, height);

            child.Arrange(destination);
            return(-destination.Width);
        }
        protected void InitializeViewHandler(IView view, IViewHandler handler, IMauiContext mauiContext = null)
        {
            handler.SetMauiContext(mauiContext ?? MauiContext);

            handler.SetVirtualView(view);
            view.Handler = handler;

            view.Arrange(new Rectangle(0, 0, view.Width, view.Height));
            handler.NativeArrange(view.Frame);
        }
示例#5
0
        internal static void LayoutToSize(this IView view, double width, double height)
        {
            var platformFrame = new CGRect(0, 0, width, height);

            if (view.Handler is IPlatformViewHandler viewHandler && viewHandler.PlatformView != null)
            {
                viewHandler.PlatformView.Frame = platformFrame;
            }

            view.Arrange(platformFrame.ToRectangle());
        }
示例#6
0
        internal static Size LayoutToMeasuredSize(this IView view, double width, double height)
        {
            var size          = view.Measure(width, height);
            var platformFrame = new CGRect(0, 0, size.Width, size.Height);

            if (view.Handler is IPlatformViewHandler viewHandler && viewHandler.PlatformView != null)
            {
                viewHandler.PlatformView.Frame = platformFrame;
            }

            view.Arrange(platformFrame.ToRectangle());
            return(size);
        }
示例#7
0
        protected THandler CreateHandler <THandler>(IView view)
            where THandler : IViewHandler
        {
            var handler = Activator.CreateInstance <THandler>();

            handler.SetMauiContext(MauiContext);

            handler.SetVirtualView(view);
            view.Handler = handler;

            view.Arrange(new Rectangle(0, 0, view.Width, view.Height));
            handler.NativeArrange(view.Frame);

            return(handler);
        }
示例#8
0
        protected THandler CreateHandler <THandler>(IView view)
            where THandler : IViewHandler
        {
            var handler = Activator.CreateInstance <THandler>();

            handler.SetMauiContext(MauiContext);

            handler.SetVirtualView(view);
            view.Handler = handler;

            var size = view.Measure(double.PositiveInfinity, double.PositiveInfinity);

            view.Arrange(new Rect(0, 0, size.Width, size.Height));
            handler.PlatformArrange(view.Frame);

            return(handler);
        }