protected override ContentViewGroup CreatePlatformView() { if (VirtualView == null) { throw new InvalidOperationException($"{nameof(VirtualView)} must be set to create a ContentViewGroup"); } var viewGroup = new ContentViewGroup(Context) { CrossPlatformMeasure = VirtualView.CrossPlatformMeasure, CrossPlatformArrange = VirtualView.CrossPlatformArrange }; return(viewGroup); }
static void InsertInsetView(IScrollViewHandler 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), Tag = InsetPanelTag }; handler.PlatformView.RemoveAllViews(); paddingShim.AddView(nativeContent); handler.PlatformView.SetContent(paddingShim); }
protected override void DisconnectHandler(ContentViewGroup platformView) { // If we're being disconnected from the xplat element, then we should no longer be managing its chidren platformView.RemoveAllViews(); base.DisconnectHandler(platformView); }