示例#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));
        }
示例#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);
        }
示例#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();
                }
            }
        }
示例#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);
            }
        }
示例#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());
        }
示例#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);
            }
        }
示例#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);
            }
        }
示例#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);
 }
示例#13
0
 static ContentViewGroup?FindInsetPanel(ScrollViewHandler handler)
 {
     return(handler.NativeView.FindViewWithTag(InsetPanelTag) as ContentViewGroup);
 }
示例#14
0
 public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView?.UpdateScrollBarVisibility(scrollView.Orientation, scrollView.HorizontalScrollBarVisibility);
 }
示例#15
0
 public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.VerticalScrollBarVisibility = scrollView.VerticalScrollBarVisibility.ToWindowsScrollBarVisibility();
 }
示例#16
0
 public static void MapContentSize(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView.UpdateContentSize(scrollView.ContentSize);
 }
示例#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
 }
示例#18
0
 public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView)
 {
     handler.NativeView?.UpdateVerticalScrollBarVisibility(scrollView.VerticalScrollBarVisibility);
 }