void InsertPageBefore(Page page, Page before) { if (before == null) throw new ArgumentNullException("before"); if (page == null) throw new ArgumentNullException("page"); var pageContainer = CreateViewControllerForPage(page); var target = Platform.GetRenderer(before).ViewController.ParentViewController; ViewControllers = ViewControllers.Insert(ViewControllers.IndexOf(target), pageContainer); }
protected virtual void OnInsertRequested(NavigationRequestedEventArgs e) { var page = e.Page; var before = e.BeforePage; var beforeRenderer = Platform.GetRenderer(before); var renderer = Platform.CreateRenderer(page); Platform.SetRenderer(page, renderer); var tracker = _context.CreatePageRendererTracker(); tracker.ViewController = renderer.ViewController; tracker.Page = page; _trackers[page] = tracker; ViewControllers.Insert(ViewControllers.IndexOf(beforeRenderer.ViewController), renderer.ViewController); }