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)); }
public static void MapContent(ScrollViewHandler handler, IScrollView scrollView) { if (handler.NativeView == null || handler.MauiContext == null) { return; } handler.NativeView.UpdateContent(scrollView.PresentedContent, handler.MauiContext); }
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(); } } }
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); } }
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()); }
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); } }
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); } }
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); }
static ContentViewGroup?FindInsetPanel(ScrollViewHandler handler) { return(handler.NativeView.FindViewWithTag(InsetPanelTag) as ContentViewGroup); }
public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView) { handler.NativeView?.UpdateScrollBarVisibility(scrollView.Orientation, scrollView.HorizontalScrollBarVisibility); }
public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView) { handler.NativeView.VerticalScrollBarVisibility = scrollView.VerticalScrollBarVisibility.ToWindowsScrollBarVisibility(); }
public static void MapContentSize(ScrollViewHandler handler, IScrollView scrollView) { handler.NativeView.UpdateContentSize(scrollView.ContentSize); }
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 }
public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView) { handler.NativeView?.UpdateVerticalScrollBarVisibility(scrollView.VerticalScrollBarVisibility); }