void UpdateCurrentShellContent(ShellContent content) { _currentContent?.Hide(); if (content == null) { _currentContent = null; return; } Native.Page native = null; if (_contentToPage.ContainsKey(content)) { native = _contentToPage[content]; } else { native = CreateShellContent(content); Control.PackEnd(native); _contentToPage.Add(content, native); } _currentContent = native; _currentContent.Show(); return; }
Native.Page CreateShellContent(ShellContent content) { Page xpage = ((IShellContentController)content).GetOrCreateContent(); Native.Page page = Platform.GetOrCreateRenderer(xpage).NativeView as Native.Page; page.BackgroundColor = (xpage.BackgroundColor != Color.Default ? xpage.BackgroundColor.ToNative() : EColor.White); return(page); }
EvasObject GetOrCreatePage(Page page) { Native.Page native = Platform.GetOrCreateRenderer(page).NativeView as Native.Page; _pageToNative[page] = native; _nativeToPage[native] = page; native.BackgroundColor = (page.BackgroundColor != Xamarin.Forms.Color.Default ? page.BackgroundColor.ToNative() : ElmSharp.Color.White); PackEnd(native); return(native); }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { if (null == _page) { _page = new Native.Page(Forms.NativeParent); _page.LayoutUpdated += OnLayoutUpdated; SetNativeView(_page); } base.OnElementChanged(e); }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { if (null == _page) { _page = new Native.Page(Forms.NativeParent); _page.LayoutUpdated += OnLayoutUpdated; SetNativeView(_page); } if (Forms.UseSkiaSharp) { _backgroundCanvas = new Lazy <SKCanvasView>(() => { var canvas = new SKCanvasView(Forms.NativeParent); canvas.PassEvents = true; canvas.PaintSurface += OnBackgroundPaint; canvas.Show(); _page.Children.Add(canvas); canvas.Lower(); return(canvas); }); } base.OnElementChanged(e); }