private void HideChildContent(ContentPresenter child, TabControlItemData tabControlItemData) { child.Content = null; child.ContentTemplate = null; tabControlItemData.TabItem.Content = null; }
private void ShowChildContent(ContentPresenter child, TabControlItemData tabControlItemData) { if (child.Content == null) { child.Content = tabControlItemData.Content; } if (child.ContentTemplate == null) { child.ContentTemplate = tabControlItemData.ContentTemplate; } tabControlItemData.TabItem.Content = child; }
/// <summary> /// Create the child ContentPresenter for the given item (could be data or a TabItem) /// </summary> /// <param name="item">The item.</param> private void CreateChildContentPresenter(object item) { if (item == null) { return; } object dummyObject = null; if (_wrappedContainers.TryGetValue(item, out dummyObject)) { return; } _wrappedContainers.Add(item, new object()); var cp = FindChildContentPresenter(item); if (cp != null) { return; } // the actual child to be added. cp.Tag is a reference to the TabItem cp = new ContentPresenter(); var container = GetContentContainer(item); var content = GetContent(item); var tabItemData = new TabControlItemData(container, content, ContentTemplate, item); cp.Tag = tabItemData; if (!IsLazyLoading) { ShowChildContent(cp, tabItemData); } cp.ContentTemplateSelector = ContentTemplateSelector; cp.ContentStringFormat = SelectedContentStringFormat; _itemsHolder.Children.Add(cp); }
private void HideChildContent(ContentPresenter child, TabControlItemData tabControlItemData) { child.Content = null; child.ContentTemplate = null; tabControlItemData.TabItem.Content = null; }
private void ShowChildContent(ContentPresenter child, TabControlItemData tabControlItemData) { if (child.Content == null) { child.Content = tabControlItemData.Content; } if (child.ContentTemplate == null) { child.ContentTemplate = tabControlItemData.ContentTemplate; } tabControlItemData.TabItem.Content = child; }
/// <summary> /// Create the child ContentPresenter for the given item (could be data or a TabItem) /// </summary> /// <param name="item">The item.</param> private void CreateChildContentPresenter(object item) { if (item == null) { return; } object dummyObject = null; if (_wrappedContainers.TryGetValue(item, out dummyObject)) { return; } _wrappedContainers.Add(item, new object()); var cp = FindChildContentPresenter(item); if (cp != null) { return; } // the actual child to be added. cp.Tag is a reference to the TabItem cp = new ContentPresenter(); var container = GetContentContainer(item); var content = GetContent(item); var tabItemData = new TabControlItemData(container, content, ContentTemplate, item); cp.Tag = tabItemData; if (!IsLazyLoading) { ShowChildContent(cp, tabItemData); } cp.ContentTemplateSelector = ContentTemplateSelector; cp.ContentStringFormat = SelectedContentStringFormat; _itemsHolder.Children.Add(cp); }