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 != System.Maui.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(System.Maui.Maui.NativeParent); _page.LayoutUpdated += OnLayoutUpdated; SetNativeView(_page); } base.OnElementChanged(e); }