Ejemplo n.º 1
0
 public static void MapRequestScrollTo(ScrollViewHandler handler, IScrollView scrollView, object?args)
 {
     if (args is ScrollToRequest request)
     {
         handler.NativeView.ChangeView(request.HoriztonalOffset, request.VerticalOffset, null, request.Instant);
     }
 }
        public static void MapContent(ScrollViewHandler handler, IScrollView scrollView)
        {
            if (handler.NativeView == null || handler.MauiContext == null || scrollView.PresentedContent == null)
            {
                return;
            }

            handler.NativeView.SetContent(scrollView.PresentedContent.ToNative(handler.MauiContext));
        }
Ejemplo n.º 3
0
        public static void MapContent(ScrollViewHandler handler, IScrollView scrollView)
        {
            if (handler.NativeView == null || handler.MauiContext == null)
            {
                return;
            }

            handler.NativeView.UpdateContent(scrollView.PresentedContent, handler.MauiContext);
        }
Ejemplo n.º 4
0
        public static void MapRequestScrollTo(ScrollViewHandler handler, IScrollView scrollView, object?args)
        {
            if (args is ScrollToRequest request)
            {
                handler.NativeView.SetContentOffset(new CoreGraphics.CGPoint(request.HoriztonalOffset, request.VerticalOffset), !request.Instant);

                if (request.Instant)
                {
                    scrollView.ScrollFinished();
                }
            }
        }
Ejemplo n.º 5
0
        public static void MapContent(ScrollViewHandler handler, IScrollView scrollView)
        {
            if (handler.NativeView == null || handler.MauiContext == null)
            {
                return;
            }

            if (NeedsInsetView(scrollView))
            {
                UpdateInsetView(scrollView, handler);
            }
            else
            {
                handler.NativeView.UpdateContent(scrollView.PresentedContent, handler.MauiContext);
            }
        }
Ejemplo n.º 6
0
        static void InsertInsetView(ScrollViewHandler handler, IScrollView scrollView, View nativeContent)
        {
            if (scrollView.PresentedContent == null || handler.MauiContext?.Context == null)
            {
                return;
            }

            var paddingShim = new ContentViewGroup(handler.MauiContext.Context)
            {
                CrossPlatformMeasure = IncludeScrollViewInsets(scrollView.CrossPlatformMeasure, scrollView),
                CrossPlatformArrange = scrollView.CrossPlatformArrange,
                Tag = InsetPanelTag
            };

            handler.NativeView.RemoveAllViews();
            paddingShim.AddView(nativeContent);
            handler.NativeView.SetContent(paddingShim);
        }
        public static void MapRequestScrollTo(ScrollViewHandler handler, IScrollView scrollView, object?args)
        {
            if (args is not ScrollToRequest request)
            {
                return;
            }

            var context = handler.NativeView.Context;

            if (context == null)
            {
                return;
            }

            var horizontalOffsetDevice = (int)context.ToPixels(request.HoriztonalOffset);
            var verticalOffsetDevice   = (int)context.ToPixels(request.VerticalOffset);

            handler.NativeView.ScrollTo(horizontalOffsetDevice, verticalOffsetDevice,
                                        request.Instant, () => handler.VirtualView.ScrollFinished());
        }
Ejemplo n.º 8
0
        static void UpdateInsetView(IScrollView scrollView, ScrollViewHandler handler)
        {
            if (scrollView.PresentedContent == null || handler.MauiContext == null)
            {
                return;
            }

            var nativeContent = scrollView.PresentedContent.ToNative(handler.MauiContext);

            if (FindInsetPanel(handler) is ContentViewGroup currentPaddingLayer)
            {
                if (currentPaddingLayer.ChildCount == 0 || currentPaddingLayer.GetChildAt(0) != nativeContent)
                {
                    currentPaddingLayer.RemoveAllViews();
                    currentPaddingLayer.AddView(nativeContent);
                }
            }
            else
            {
                InsertInsetView(handler, scrollView, nativeContent);
            }
        }
Ejemplo n.º 9
0
        static void UpdateInsetPanel(IScrollView scrollView, ScrollViewHandler handler)
        {
            if (scrollView.PresentedContent == null || handler.MauiContext == null)
            {
                return;
            }

            var scrollViewer  = handler.NativeView;
            var nativeContent = scrollView.PresentedContent.ToNative(handler.MauiContext);

            if (GetInsetPanel(scrollViewer) is ContentPanel currentPaddingLayer)
            {
                if (currentPaddingLayer.Children.Count == 0 || currentPaddingLayer.Children[0] != nativeContent)
                {
                    currentPaddingLayer.Children.Clear();
                    currentPaddingLayer.Children.Add(nativeContent);
                }
            }
            else
            {
                InsertInsetPanel(scrollViewer, scrollView, nativeContent);
            }
        }
Ejemplo n.º 10
0
 public static void MapRequestScrollTo(ScrollViewHandler handler, IScrollView scrollView, object?args)
 {
 }
 public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.SetOrientation(scrollView.Orientation);
 }
 public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.SetVerticalScrollBarVisibility(scrollView.HorizontalScrollBarVisibility);
 }
Ejemplo n.º 13
0
 static ContentViewGroup?FindInsetPanel(ScrollViewHandler handler)
 {
     return(handler.NativeView.FindViewWithTag(InsetPanelTag) as ContentViewGroup);
 }
Ejemplo n.º 14
0
 public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView?.UpdateScrollBarVisibility(scrollView.Orientation, scrollView.HorizontalScrollBarVisibility);
 }
Ejemplo n.º 15
0
 public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.VerticalScrollBarVisibility = scrollView.VerticalScrollBarVisibility.ToWindowsScrollBarVisibility();
 }
Ejemplo n.º 16
0
 public static void MapContentSize(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.UpdateContentSize(scrollView.ContentSize);
 }
Ejemplo n.º 17
0
 public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView)
 {
     // Nothing to do here for now, but we might need to make adjustments for FlowDirection when the orientation is set to Horizontal
 }
Ejemplo n.º 18
0
 public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView?.UpdateVerticalScrollBarVisibility(scrollView.VerticalScrollBarVisibility);
 }