internal void CheckContentsEmpty() { if (Items.Count == 0) { bool isMainDocPaneToBeClosed = IsMainDocumentPane.HasValue && IsMainDocumentPane.Value; if (isMainDocPaneToBeClosed) { DockingManager manager = GetManager(); DocumentPane candidateNewMainDocPane = manager.FindAnotherLogicalChildContained <DocumentPane>(this); if (candidateNewMainDocPane != null && candidateNewMainDocPane.GetManager() == this.GetManager()) { ResizingPanel containerPanel = Parent as ResizingPanel; if (containerPanel != null) { containerPanel.RemoveChild(this); } manager.MainDocumentPane = candidateNewMainDocPane; candidateNewMainDocPane.NotifyPropertyChanged("IsMainDocumentPane"); } } else { ResizingPanel containerPanel = Parent as ResizingPanel; if (containerPanel != null) { containerPanel.RemoveChild(this); } } } }
internal void CheckContentsEmpty() { if (IsMainDocumentPane.HasValue && !IsMainDocumentPane.Value && Items.Count == 0) { ResizingPanel containerPanel = Parent as ResizingPanel; if (containerPanel != null) { containerPanel.RemoveChild(this); } } }
public override ManagedContent RemoveContent(int index) { ManagedContent content = base.RemoveContent(index); if (Items.Count == 0) { ResizingPanel containerPanel = Parent as ResizingPanel; if (containerPanel != null) { containerPanel.RemoveChild(this); } } return(content); }
/// <summary> /// Remove a child from children collection /// </summary> /// <param name="childToRemove"></param> internal void RemoveChild(FrameworkElement childToRemove) { int indexOfChildToRemove = Children.IndexOf(childToRemove); Debug.Assert(indexOfChildToRemove != -1); Children.RemoveAt(indexOfChildToRemove); if (Children.Count > 0) { SetupSplitters(); if (Children.Count == 1) { UIElement singleChild = this.Children[0]; if (Parent is ResizingPanel) { ResizingPanel parentPanel = Parent as ResizingPanel; if (parentPanel != null) { int indexOfThisPanel = parentPanel.Children.IndexOf(this); parentPanel.Children.RemoveAt(indexOfThisPanel); this.Children.Remove(singleChild); parentPanel.Children.Insert(indexOfThisPanel, singleChild); } } else if (Parent is DockingManager) { DockingManager manager = Parent as DockingManager; if (manager != null) { this.Children.Remove(singleChild); manager.Content = singleChild; } } } } else { ResizingPanel parentPanel = Parent as ResizingPanel; if (parentPanel != null) { parentPanel.RemoveChild(this); } } }
internal override ManagedContent RemoveContent(int index) { ManagedContent content = base.RemoveContent(index); DockableContent dockableContent = content as DockableContent; if (((dockableContent == null) || (dockableContent != null && dockableContent.SavedStateAndPosition == null) || (dockableContent != null && dockableContent.SavedStateAndPosition.ContainerPane != this)) && Items.Count == 0) { ResizingPanel containerPanel = Parent as ResizingPanel; if (containerPanel != null) { containerPanel.RemoveChild(this); } } return(content); }
internal void ClearEmptyPanels(ResizingPanel panelToClear) { if (panelToClear == null) return; foreach (var childPanel in panelToClear.Children.OfType<ResizingPanel>().ToArray()) { if (childPanel.Children.Count == 0) { panelToClear.RemoveChild(childPanel); } else { ClearEmptyPanels(childPanel); } } }