void InsertItem(object item, int index, bool newItem) { DependencyObject pageContent = PageTemplate.LoadContent(); var pageItem = (Page)item; PanoramaItem container = GetPageContainer(pageItem); if (container == null) { container = new PanoramaItem { DataContext = item, Content = pageContent }; SetPageContainer(pageItem, container); } Items.Insert(index, container); }
static void SetPageContainer(BindableObject bindable, PanoramaItem container) { bindable.SetValue(PageContainerProperty, container); }