Exemplo n.º 1
0
        private void ComputeLogicalReplacements()
        {
            if (DockableCollection.IsCollapsed)
            {
                //  The space previously occupied by the compressed collection will fill filled by other collection(s). This
                //  will occur on either the vertical or horizontal axes. If this edge is on the edge of expansion, then the
                //  visible edge will be the expanding collections. Otherwise, it will be empty.
                //
                //  The edge(s) through which expansion is likely to occur owns the replacement. Other edges will have a null replacement.

                LayoutContext.ComputeLogicalReplacements(out LinkedList <LayoutContext> contactingEdgeReplacements, out LinkedList <LayoutContext> opposingEdgeReplacements, LayoutContext.OpposingNeighbors[EdgesDockPosition]);
                if (contactingEdgeReplacements == null)
                {
                    _logicalReplacements = opposingEdgeReplacements;
                }
                else if (opposingEdgeReplacements == null)
                {
                    _logicalReplacements = contactingEdgeReplacements;
                }
                else
                {
                    _logicalReplacements = new LinkedList <LayoutContext>();
                    switch (EdgesDockPosition)
                    {
                    case System.Windows.Controls.Dock.Left:
                    case System.Windows.Controls.Dock.Top:
                        foreach (var entry in contactingEdgeReplacements)
                        {
                            _logicalReplacements.AddLast(entry);
                        }
                        foreach (var entry in opposingEdgeReplacements)
                        {
                            _logicalReplacements.AddLast(entry);
                        }
                        break;

                    default:
                        foreach (var entry in opposingEdgeReplacements)
                        {
                            _logicalReplacements.AddLast(entry);
                        }
                        foreach (var entry in contactingEdgeReplacements)
                        {
                            _logicalReplacements.AddLast(entry);
                        }
                        break;
                    }
                }
            }
            else
            {
                _logicalReplacements = null;
            }
        }