public DockablePaneGroup GetPaneGroup(Pane pane) { if (AttachedPane == pane) { return(this); } if (FirstChildGroup != null) { DockablePaneGroup paneGroup = FirstChildGroup.GetPaneGroup(pane); if (paneGroup != null) { return(paneGroup); } } if (SecondChildGroup != null) { DockablePaneGroup paneGroup = SecondChildGroup.GetPaneGroup(pane); if (paneGroup != null) { return(paneGroup); } } return(null); }
public DockablePaneGroup RemovePane(DockablePane pane) { if (AttachedPane != null) { return(null); } if (FirstChildGroup.AttachedPane == pane) { return(SecondChildGroup); } else if (SecondChildGroup.AttachedPane == pane) { return(FirstChildGroup); } else { DockablePaneGroup group = FirstChildGroup.RemovePane(pane); if (group != null) { FirstChildGroup = group; group._parentGroup = this; return(null); } group = SecondChildGroup.RemovePane(pane); if (group != null) { SecondChildGroup = group; group._parentGroup = this; return(null); } } return(null); }
public Pane GetPaneFromContent(DockableContent content) { if (AttachedPane != null && AttachedPane.Contents.Contains(content)) { return(AttachedPane); } if (FirstChildGroup != null) { Pane pane = FirstChildGroup.GetPaneFromContent(content); if (pane != null) { return(pane); } } if (SecondChildGroup != null) { return(SecondChildGroup.GetPaneFromContent(content)); } return(null); }
public void Serialize(XmlDocument doc, XmlNode parentNode) { parentNode.Attributes.Append(doc.CreateAttribute("Dock")); parentNode.Attributes["Dock"].Value = _dock.ToString(); if (AttachedPane != null) { XmlNode nodeAttachedPane = null; if (AttachedPane is DockablePane) { nodeAttachedPane = doc.CreateElement("DockablePane"); } else if (AttachedPane is DocumentsPane) { nodeAttachedPane = doc.CreateElement("DocumentsPane"); } AttachedPane.Serialize(doc, nodeAttachedPane); parentNode.AppendChild(nodeAttachedPane); } else { XmlNode nodeChildGroups = doc.CreateElement("ChildGroups"); XmlNode nodeFirstChildGroup = doc.CreateElement("FirstChildGroup"); FirstChildGroup.Serialize(doc, nodeFirstChildGroup); nodeChildGroups.AppendChild(nodeFirstChildGroup); XmlNode nodeSecondChildGroup = doc.CreateElement("SecondChildGroup"); SecondChildGroup.Serialize(doc, nodeSecondChildGroup); nodeChildGroups.AppendChild(nodeSecondChildGroup); parentNode.AppendChild(nodeChildGroups); } }
public void Arrange(Grid grid) { if (AttachedPane != null)//AttachedPane.IsHidden) { grid.Children.Add(AttachedPane); } else if (FirstChildGroup.IsHidden && !SecondChildGroup.IsHidden) { SecondChildGroup.Arrange(grid); } else if (!FirstChildGroup.IsHidden && SecondChildGroup.IsHidden) { FirstChildGroup.Arrange(grid); } else { if (Dock == Dock.Left || Dock == Dock.Right) { grid.RowDefinitions.Add(new RowDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.ColumnDefinitions.Add(new ColumnDefinition()); //grid.ColumnDefinitions[0].Width = (Dock == Dock.Left) ? new GridLength(AttachedPane.PaneWidth) : new GridLength(1, GridUnitType.Star); //grid.ColumnDefinitions[1].Width = (Dock == Dock.Right) ? new GridLength(AttachedPane.PaneWidth) : new GridLength(1, GridUnitType.Star); grid.ColumnDefinitions[0].Width = (Dock == Dock.Left) ? FirstChildGroup.GroupWidth : new GridLength(1, GridUnitType.Star); grid.ColumnDefinitions[1].Width = (Dock == Dock.Right) ? SecondChildGroup.GroupWidth : new GridLength(1, GridUnitType.Star); //grid.ColumnDefinitions[0].MinWidth = 50; //grid.ColumnDefinitions[1].MinWidth = 50; Grid firstChildGrid = new Grid(); firstChildGrid.SetValue(Grid.ColumnProperty, 0); firstChildGrid.Margin = new Thickness(0, 0, 4, 0); FirstChildGroup.Arrange(firstChildGrid); grid.Children.Add(firstChildGrid); Grid secondChildGrid = new Grid(); secondChildGrid.SetValue(Grid.ColumnProperty, 1); //secondChildGrid.Margin = (Dock == Dock.Right) ? new Thickness(0, 0, 4, 0) : new Thickness(); SecondChildGroup.Arrange(secondChildGrid); grid.Children.Add(secondChildGrid); //AttachedPane.SetValue(Grid.ColumnProperty, (Dock == Dock.Right) ? 1 : 0); //AttachedPane.Margin = (Dock == Dock.Left) ? new Thickness(0, 0, 4, 0) : new Thickness(); //grid.Children.Add(AttachedPane); GridSplitter splitter = new GridSplitter(); splitter.Width = 4; splitter.HorizontalAlignment = HorizontalAlignment.Right; splitter.VerticalAlignment = VerticalAlignment.Stretch; grid.Children.Add(splitter); } else // if (Dock == Dock.Top || Dock == Dock.Bottom) { grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions.Add(new RowDefinition()); //grid.RowDefinitions[0].Height = (Dock == Dock.Top) ? new GridLength(AttachedPane.PaneHeight) : new GridLength(1, GridUnitType.Star); //grid.RowDefinitions[1].Height = (Dock == Dock.Bottom) ? new GridLength(AttachedPane.PaneHeight) : new GridLength(1, GridUnitType.Star); grid.RowDefinitions[0].Height = (Dock == Dock.Top) ? FirstChildGroup.GroupHeight : new GridLength(1, GridUnitType.Star); grid.RowDefinitions[1].Height = (Dock == Dock.Bottom) ? SecondChildGroup.GroupHeight : new GridLength(1, GridUnitType.Star); grid.RowDefinitions[0].MinHeight = 50; grid.RowDefinitions[1].MinHeight = 50; Grid firstChildGrid = new Grid(); //firstChildGrid.SetValue(Grid.RowProperty, (Dock == Dock.Bottom) ? 1 : 0); firstChildGrid.SetValue(Grid.RowProperty, 0); //firstChildGrid.Margin = (Dock == Dock.Bottom) ? new Thickness(0, 0, 0, 4) : new Thickness(); firstChildGrid.Margin = new Thickness(0, 0, 0, 4); FirstChildGroup.Arrange(firstChildGrid); grid.Children.Add(firstChildGrid); Grid secondChildGrid = new Grid(); //secondChildGrid.SetValue(Grid.RowProperty, (Dock == Dock.Top) ? 1 : 0); secondChildGrid.SetValue(Grid.RowProperty, 1); //secondChildGrid.Margin = (Dock == Dock.Bottom) ? new Thickness(0, 0, 0, 4) : new Thickness(); SecondChildGroup.Arrange(secondChildGrid); grid.Children.Add(secondChildGrid); //AttachedPane.SetValue(Grid.RowProperty, (Dock == Dock.Bottom) ? 1 : 0); //AttachedPane.Margin = (Dock == Dock.Top) ? new Thickness(0, 0, 0, 4) : new Thickness(); //grid.Children.Add(AttachedPane); GridSplitter splitter = new GridSplitter(); splitter.Height = 4; splitter.HorizontalAlignment = HorizontalAlignment.Stretch; splitter.VerticalAlignment = VerticalAlignment.Bottom; grid.Children.Add(splitter); } } }