コード例 #1
0
        private void SetRootNode(DockPaneNode newValue, bool clearOldValueParent)
        {
            DockPaneNode oldValue = RootNode;

            if (oldValue == newValue)
            {
                return;
            }

            SetValue(RootNodePropertyKey, newValue);

            if (oldValue != null && clearOldValueParent)
            {
                oldValue.ClearParent();
            }

            if (newValue != null)
            {
                newValue.SetParent(this);
            }
        }
コード例 #2
0
        internal DockPane AddItem(DockItem item, DockPaneNode targetPaneNode, bool isAutoHide, Dock side, SplitterDistance size, bool isSizeForTarget)
        {
            Debug.Assert(targetPaneNode.DockTree == this);

            DockPane pane = DockControl.PaneManager.CreatePane(item, isAutoHide);

            AddDirtyNode(pane);
            AddDirtyNode(targetPaneNode);

            DockPaneSplit parent            = targetPaneNode.Parent;
            DockPaneNode  child1            = side == Dock.Left || side == Dock.Top ? pane : targetPaneNode;
            DockPaneNode  child2            = side == Dock.Left || side == Dock.Top ? targetPaneNode : pane;
            Orientation   orientation       = side == Dock.Left || side == Dock.Right ? Orientation.Horizontal : Orientation.Vertical;
            bool          isSplitterTopLeft = isSizeForTarget ? child1 == targetPaneNode : child2 == targetPaneNode;

            targetPaneNode.ClearParent();
            DockPaneSplit newSplit;

            newSplit = new DockPaneSplit(child1, child2, orientation, isSplitterTopLeft, size);
            AddDirtyNode(newSplit);
            if (parent != null)
            {
                AddDirtyNode(parent);
                parent.SetSibling(parent.GetSibling(targetPaneNode), newSplit);
            }
            else
            {
                SetRootNode(newSplit, false);
            }
            AddPaneToCollection(pane);
            Debug.Assert(newSplit.Child1 != null);
            Debug.Assert(newSplit.Child1.Parent == newSplit);
            Debug.Assert(newSplit.Child2 != null);
            Debug.Assert(newSplit.Child2.Parent == newSplit);
            return(pane);
        }