예제 #1
0
        public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane)
            : this(manager)
        {
            //create a new temporary pane
            FloatingDockablePane pane = new FloatingDockablePane(this);

            //setup window size
            ManagedContent selectedContent = dockablePane.SelectedItem as ManagedContent;

            if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty)
            {
                selectedContent.FloatingWindowSize = new Size(dockablePane.ActualWidth, dockablePane.ActualHeight);
            }

            if (selectedContent != null)
            {
                Width           = selectedContent.FloatingWindowSize.Width;
                Height          = selectedContent.FloatingWindowSize.Height;
                this.ResizeMode = selectedContent.FloatingResizeMode;
            }
            else
            {
                Width  = dockablePane.ActualWidth;
                Height = dockablePane.ActualHeight;
            }

            //transfer the style from the original dockablepane
            pane.Style = dockablePane.Style;

            //Width = dockablePane.ActualWidth;
            //Height = dockablePane.ActualHeight;

            ////save current content position in container pane
            //pane.SetValue(ResizingPanel.ResizeWidthProperty, dockablePane.GetValue(ResizingPanel.ResizeWidthProperty));
            //pane.SetValue(ResizingPanel.ResizeHeightProperty, dockablePane.GetValue(ResizingPanel.ResizeHeightProperty));

            int selectedIndex = dockablePane.SelectedIndex;

            //remove contents from container pane and insert in hosted pane
            while (dockablePane.Items.Count > 0)
            {
                ManagedContent content = dockablePane.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;
        }
예제 #2
0
        internal void DropInto(DockablePane paneDragged, DockablePane paneToDropInto)
        {
            //transfer tha contents of dragged pane (conatined in a FloatingWindow)
            //to the pane which user select, taking care of setting contents state
            //to Dock (using Dock() method of class DockablePane).
            while (paneDragged.Items.Count > 0)
            {
                ManagedContent contentToTransfer = paneDragged.RemoveContent(0);
                paneToDropInto.Items.Add(contentToTransfer);

                DockableContent dockContentToTransfer = contentToTransfer as DockableContent;

                if (dockContentToTransfer != null)
                    dockContentToTransfer.SetStateToDock();
            }

            paneToDropInto.SelectedIndex = paneToDropInto.Items.Count - 1;
            //paneToDropInto.Focus();
        }
        public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane)
            : this(manager)
        {
            //create a new temporary pane
            FloatingDockablePane pane = new FloatingDockablePane(this);

            //setup window size
            ManagedContent selectedContent = dockablePane.SelectedItem as ManagedContent;

            if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty)
                selectedContent.FloatingWindowSize = new Size(dockablePane.ActualWidth, dockablePane.ActualHeight);

            if (selectedContent != null)
            {
                Width = selectedContent.FloatingWindowSize.Width;
                Height = selectedContent.FloatingWindowSize.Height;
                this.ResizeMode = selectedContent.FloatingResizeMode;
            }
            else
            {
                Width = dockablePane.ActualWidth;
                Height = dockablePane.ActualHeight;
            }

            //transfer the style from the original dockablepane
            pane.Style = dockablePane.Style;

            //Width = dockablePane.ActualWidth;
            //Height = dockablePane.ActualHeight;

            ////save current content position in container pane
            //pane.SetValue(ResizingPanel.ResizeWidthProperty, dockablePane.GetValue(ResizingPanel.ResizeWidthProperty));
            //pane.SetValue(ResizingPanel.ResizeHeightProperty, dockablePane.GetValue(ResizingPanel.ResizeHeightProperty));

            int selectedIndex = dockablePane.SelectedIndex;

            //remove contents from container pane and insert in hosted pane
            while (dockablePane.Items.Count > 0)
            {
                ManagedContent content = dockablePane.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;
        }
        protected override void OnInitialized(EventArgs e)
        {
            if (_paneToTransfer != null)
            {
                //setup window size
                var selectedContent = _paneToTransfer.SelectedItem as ManagedContent;
                if (selectedContent is DockableContent)
                {
                    _floatingWindow.SizeToContent = (selectedContent as DockableContent).FloatingWindowSizeToContent;
                }

                if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty)
                {
                    selectedContent.FloatingWindowSize = new Size(_paneToTransfer.ActualWidth,
                                                                  _paneToTransfer.ActualHeight);
                }

                if (selectedContent != null)
                {
                    _floatingWindow.Width  = selectedContent.FloatingWindowSize.Width;
                    _floatingWindow.Height = selectedContent.FloatingWindowSize.Height;
                }
                else
                {
                    _floatingWindow.Width  = _paneToTransfer.ActualWidth;
                    _floatingWindow.Height = _paneToTransfer.ActualHeight;
                }

                var selectedIndex = _paneToTransfer.SelectedIndex;

                //remove contents from container pane and insert in hosted pane
                while (_paneToTransfer.Items.Count > 0)
                {
                    var contentToTranser = _paneToTransfer.Items[0] as DockableContent;

                    contentToTranser.SaveCurrentStateAndPosition();

                    _paneToTransfer.RemoveContent(0);

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

                    contentToTranser.SetStateToDockableWindow();
                }

                SelectedIndex = selectedIndex;

                //transfer the style from the original dockablepane
                //Style = _paneToTransfer.Style;
                AttachStyleFromPane(_paneToTransfer);

                ApplyTemplate();

                LayoutTransform = (MatrixTransform)_paneToTransfer.TansformToAncestor();
            }
            else if (_contentToTransfer != null)
            {
                //setup window size
                if (_contentToTransfer.FloatingWindowSize.IsEmpty)
                {
                    _contentToTransfer.FloatingWindowSize = new Size(_contentToTransfer.ContainerPane.ActualWidth,
                                                                     _contentToTransfer.ContainerPane.ActualHeight);
                }

                _floatingWindow.Width  = _contentToTransfer.FloatingWindowSize.Width;
                _floatingWindow.Height = _contentToTransfer.FloatingWindowSize.Height;

                //save current content position in container pane
                _previousPane = _contentToTransfer.ContainerPane;

                _arrayIndexPreviousPane = _previousPane.Items.IndexOf(_contentToTransfer);

                _contentToTransfer.SaveCurrentStateAndPosition();

                //remove content from container pane
                _contentToTransfer.ContainerPane.RemoveContent(_arrayIndexPreviousPane);

                //add content to this pane
                Items.Add(_contentToTransfer);

                SelectedIndex = 0;


                AttachStyleFromPane(_previousPane as DockablePane);

                var originalDocumentPane = _previousPane as DocumentPane;
                if (originalDocumentPane != null)
                {
                    originalDocumentPane.CheckContentsEmpty();
                }


                _contentToTransfer.SetStateToDockableWindow();
                LayoutTransform = (MatrixTransform)_contentToTransfer.TansformToAncestor();
            }

            base.OnInitialized(e);
        }