Пример #1
0
        public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane)
            : this(manager)
        {
            //create a new temporary pane
            FloatingDockablePane pane = new FloatingDockablePane(this);

            //setup window size
            Width  = dockablePane.ActualWidth;
            Height = dockablePane.ActualHeight;

            //save current content position in container pane
            _previousPane           = dockablePane;
            _arrayIndexPreviousPane = -1;
            pane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty));
            pane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty));

            int selectedIndex = _previousPane.SelectedIndex;

            //remove contents from container pane and insert in hosted pane
            while (_previousPane.Items.Count > 0)
            {
                ManagedContent content = _previousPane.RemoveContent(0);

                //add content to my temporary pane
                pane.Items.Add(content);
            }

            //let templates access this pane
            HostedPane = pane;
            HostedPane.SelectedIndex = selectedIndex;

            //Change state on contents
            IsDockableWindow = true;
        }
        /// <summary>
        /// Remove this content from its parent container pane
        /// </summary>
        /// <returns></returns>
        internal virtual ManagedContent DetachFromContainerPane()
        {
            if (ContainerPane != null)
            {
                int indexOfContent = ContainerPane.Items.IndexOf(this);
                return(ContainerPane.RemoveContent(indexOfContent) as ManagedContent);
            }

            return(null);
        }