public void AppendContent(ContentPane contentPane)
        {
            List <Pane> dockedPanes = contentPane.DockedPanes;

            foreach (Pane pane in dockedPanes.ToArray())
            {
                contentPane.RemovePane(pane);
                MainContent.AddPane(pane);
            }
        }
示例#2
0
        public void UnDocking(ContentPane contentPane)
        {
            DockPane dockPane = contentPane.ParentDockPane;

            dockPane.Background = Brushes.Black;
            dockPane.RemoveContentPane(contentPane);

            Point point = PointToScreen(System.Windows.Input.Mouse.GetPosition(this));

            FloatingWindow floatingWindow = new FloatingWindow
            {
                MainContent = contentPane,
                Left        = point.X,
                Top         = point.Y
            };

            floatingWindow.Show();
            floatingWindow.Activate();

            //Arrange Grid
            ArrangeDockPane(dockPane);
            ArrangeGrid(dockPane.ParentDockPane);
        }
示例#3
0
        public void Docking(DockPane dockPane, EDock dockPos)
        {
            GridSplitter splitter = new GridSplitter();

            splitter.Background = Brushes.LightGray;

            dockPane.ParentWindow   = null;
            dockPane.ParentDockPane = this;

            dockPane.DockedPos = dockPos;

            switch (dockPos)
            {
            case EDock.Top:
            {
                if (panelTop.Children.Count > 0)
                {
                    if (panelTop.Children[0] is DockPane dockedPane)
                    {
                        dockedPane.Docking(dockPane, EDock.Center);
                    }
                }
                else
                {
                    splitter.Height = 10;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.SetValue(Grid.ColumnProperty, 0);
                    splitter.SetValue(Grid.ColumnSpanProperty, 5);
                    splitter.SetValue(Grid.RowProperty, 1);
                    panelTop.Children.Add(dockPane);
                }
            }
            break;

            case EDock.Left:
            {
                if (panelLeft.Children.Count > 0)
                {
                    if (panelLeft.Children[0] is DockPane dockedPane)
                    {
                        dockedPane.Docking(dockPane, EDock.Center);
                    }
                }
                else
                {
                    splitter.Width = 10;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.SetValue(Grid.ColumnProperty, 1);
                    splitter.SetValue(Grid.RowProperty, 2);
                    panelLeft.Children.Add(dockPane);
                }
            }
            break;

            case EDock.Center:
            {
                if (panelCenter.Children.Count > 0)
                {
                    if (panelCenter.Children[0] is ContentPane contentPane)
                    {
                        ContentPane dockedContentPane = dockPane.panelCenter.Children[0] as ContentPane;
                        foreach (Pane pane in dockedContentPane.DockedPanes.ToArray())
                        {
                            dockedContentPane.RemovePane(pane);
                            contentPane.AddPane(pane);
                        }
                    }
                }
                else
                {
                    panelCenter.Children.Add(dockPane);
                }
            }
            break;

            case EDock.Right:
            {
                if (panelRight.Children.Count > 0)
                {
                    if (panelRight.Children[0] is DockPane dockedPane)
                    {
                        dockedPane.Docking(dockPane, EDock.Center);
                    }
                }
                else
                {
                    splitter.Width = 10;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.SetValue(Grid.ColumnProperty, 3);
                    splitter.SetValue(Grid.RowProperty, 2);
                    panelRight.Children.Add(dockPane);
                }
            }
            break;

            case EDock.Bottom:
            {
                if (panelBottom.Children.Count > 0)
                {
                    if (panelBottom.Children[0] is DockPane dockedPane)
                    {
                        dockedPane.Docking(dockPane, EDock.Center);
                    }
                }
                else
                {
                    splitter.Height = 10;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.SetValue(Grid.ColumnProperty, 0);
                    splitter.SetValue(Grid.ColumnSpanProperty, 5);
                    splitter.SetValue(Grid.RowProperty, 3);
                    panelBottom.Children.Add(dockPane);
                }
            }
            break;

            default:
                break;
            }
            DockManager.Instance.Sample = this;
            mainGrid.Children.Add(splitter);
        }
示例#4
0
 public void RemoveContentPane(ContentPane contentPane)
 {
     panelCenter.Children.Remove(contentPane);
 }
示例#5
0
 public void SetContentPane(ContentPane contentPane)
 {
     panelCenter.Children.Add(contentPane);
 }