Exemplo n.º 1
0
            internal DockableCollection Create(Dock dock, DockableContextContentCreator contentCreator)
            {
                DockableCollection newCollection = new DockableCollection()
                {
                    Description = this.Description,
                    HorizontalContentAlignment = this.HorizontalContentAlignment,
                    State       = this.State,
                    TabPosition = this.TabPosition,
                    VerticalContentAlignment = this.VerticalContentAlignment,
                };

                DockingPanel.SetDockPosition(newCollection, this.DockPosition);

                if (newCollection.IsCollapsed)
                {
                    newCollection.CollapsedTabPosition = this.CollapsedTabPosition;
                }

                foreach (DockableContentDescriptor desc in Content)
                {
                    FrameworkElement content = desc.RestoreDockedLayout(newCollection, contentCreator);
                    if (content != null && desc.InternalId == CurrentTab)
                    {
                        newCollection.SetVisibleContent(content);
                    }
                }
                dock.Items.Add(newCollection);

                if (!newCollection.IsCollapsed)
                {
                    LayoutContext layoutContext = DockingPanel.GetLayoutContext(newCollection);
                    layoutContext.Left = Left;
                    layoutContext.Top  = Top;
                    if (IsHeightSplitterActive)
                    {
                        layoutContext.Size.Height.SetSplitter(LayoutHeight.Value);
                    }
                    else
                    {
                        layoutContext.Size.Height.SetInternalValue(LayoutHeight);
                    }
                    if (IsWidthSplitterActive)
                    {
                        layoutContext.Size.Width.SetSplitter(LayoutWidth.Value);
                    }
                    else
                    {
                        layoutContext.Size.Width.SetInternalValue(LayoutWidth);
                    }
                    layoutContext.Size.Height.SetUserValue(Height.Value);
                    layoutContext.Size.Width.SetUserValue(Width.Value);
                }

                return(newCollection);
            }