DocumentPaneGroup ILayoutFactory.MakeDocumentPaneGroup() { DocumentPaneGroup documentPaneGroup = new DocumentPaneGroup(); IDockPaneManager.RegisterDockPane(documentPaneGroup); return(documentPaneGroup); }
void IDockPaneHost.ActiveDocumentChanged(DocumentPaneGroup documentPaneGroup) { HandleActiveDocumentChanged(documentPaneGroup, documentPaneGroup.IViewContainer, documentPaneGroup.IViewContainer.SelectedIndex); }
public void Unfloat(FloatingPane floatingPane, SelectablePane selectedPane, WindowLocation windowLocation) { Application.Current.Dispatcher.Invoke((Action) delegate { if ( (floatingPane == null) || ((selectedPane != null) && !(selectedPane.Parent is SplitterPane) && !(selectedPane.Parent is DocumentPanel) && (selectedPane.Parent != IDockPaneHost)) ) { return; } SplitterPane parentSplitterPane = null; DockPane dockPane = null; switch (windowLocation) { case WindowLocation.BottomSide: case WindowLocation.TopSide: case WindowLocation.LeftSide: case WindowLocation.RightSide: if (floatingPane is FloatingToolPaneGroup) { dockPane = ILayoutFactory.MakeToolPaneGroup(); } else { dockPane = ILayoutFactory.MakeDocumentPaneGroup(); } dockPane.IViewContainer.ExtractDocuments(floatingPane.IViewContainer); floatingPane.Close(); parentSplitterPane = ILayoutFactory.MakeSplitterPane((windowLocation == WindowLocation.TopSide) || (windowLocation == WindowLocation.BottomSide)); bool isFirst = (windowLocation == WindowLocation.TopSide) || (windowLocation == WindowLocation.LeftSide); parentSplitterPane.AddChild(dockPane, isFirst); if (IDockPaneHost.Children.Count == 0) { IDockPaneHost.Children.Add(parentSplitterPane); } else { Grid rootPane = IDockPaneHost.RootPane; IDockPaneHost.RootPane = parentSplitterPane; parentSplitterPane.AddChild(rootPane, !isFirst); } break; case WindowLocation.Right: case WindowLocation.Left: case WindowLocation.Top: case WindowLocation.Bottom: if (floatingPane is FloatingToolPaneGroup) { dockPane = ILayoutFactory.MakeToolPaneGroup(); } else { dockPane = ILayoutFactory.MakeDocumentPaneGroup(); } dockPane.IViewContainer.ExtractDocuments(floatingPane.IViewContainer); floatingPane.Close(); SplitterPane newGrid = ILayoutFactory.MakeSplitterPane((windowLocation == WindowLocation.Top) || (windowLocation == WindowLocation.Bottom)); if (selectedPane.Parent is DocumentPanel) { DocumentPanel documentPanel = selectedPane.Parent as DocumentPanel; documentPanel.Children.Remove(selectedPane); documentPanel.Children.Add(newGrid); } else { parentSplitterPane = (selectedPane.Parent as SplitterPane); parentSplitterPane.Children.Remove(selectedPane); parentSplitterPane.Children.Add(newGrid); Grid.SetRow(newGrid, Grid.GetRow(selectedPane)); Grid.SetColumn(newGrid, Grid.GetColumn(selectedPane)); } bool isTargetFirst = (windowLocation == WindowLocation.Right) || (windowLocation == WindowLocation.Bottom); newGrid.AddChild(selectedPane, isTargetFirst); newGrid.AddChild(dockPane, !isTargetFirst); break; case WindowLocation.Middle: if (selectedPane is DockPane) { (selectedPane as DockPane).IViewContainer.ExtractDocuments(floatingPane.IViewContainer); floatingPane.Close(); } else if (selectedPane is DocumentPanel) { DocumentPaneGroup documentPaneGroup = ILayoutFactory.MakeDocumentPaneGroup(); selectedPane.Children.Add(documentPaneGroup); documentPaneGroup.IViewContainer.ExtractDocuments(floatingPane.IViewContainer); floatingPane.Close(); } break; } Application.Current.MainWindow.Activate(); }); }