Beispiel #1
0
        //Sangdd 10/08/2011
        /// <summary>
        /// Close dockablecontent
        /// </summary>
        /// <param name="contentToClose">Tra ve ten dockableconetn</param>
        void CloseThis(ManagedContent contentToClose)
        {
            if (GetManager() == null)
            {
                return;
            }

            if (contentToClose == null)
            {
                contentToClose = SelectedItem as ManagedContent;
            }


            DockableContent dockableContent = contentToClose as DockableContent;

            if (dockableContent != null)
            {
                dockableContent.Close();
            }
            else
            {
                DocumentContent documentContent = contentToClose as DocumentContent;
                documentContent.Close();
            }
        }
Beispiel #2
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;
        }
Beispiel #3
0
        //ApplicationCommands.Close command....

        public void ExecutedCloseCommand(object sender,
                                         ExecutedRoutedEventArgs e)
        {
            if (GetManager() == null)
            {
                return;
            }

            ManagedContent contentToClose = SelectedItem as ManagedContent;

            if (e.Parameter is ManagedContent)
            {
                contentToClose = e.Parameter as ManagedContent;
            }

            DockableContent dockableContent = contentToClose as DockableContent;

            if (dockableContent != null)
            {
                CloseOrHide(dockableContent);
            }
            else
            {
                DocumentContent documentContent = contentToClose as DocumentContent;
                documentContent.Close();

                //if (documentContent != null)
                //    Items.Remove(documentContent);

                //CheckContentsEmpty();
            }
        }
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            ManagedContent selectedContent = this.SelectedItem as ManagedContent;
            if (selectedContent != null && GetManager() != null)
                GetManager().ActiveDocument = selectedContent;

            base.OnSelectionChanged(e);
        }
Beispiel #5
0
        public virtual ManagedContent RemoveContent(int index)
        {
            ManagedContent contentToRemove = Items[index] as ManagedContent;

            Items.RemoveAt(index);

            return(contentToRemove);
        }
Beispiel #6
0
        protected override void OnActivated(EventArgs e)
        {
            if (Manager != null)
            {
                lastActiveContent     = Manager.ActiveContent;
                Manager.ActiveContent = HostedPane.SelectedItem as ManagedContent;
            }

            base.OnActivated(e);
        }
        private void OnViewsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (m_selector != null)
            {
                if (e.Action == NotifyCollectionChangedAction.Add)
                {
                    ManagedContent managedContent = null;
                    object         newView        = e.NewItems[0];
                    string         header         = GetHeaderInfoFromView(newView);
                    if (m_selector is DockablePane)
                    {
                        managedContent = new DockableContent
                        {
                            Name          = Name,
                            Content       = newView,
                            DockableStyle = DockableStyle.Document,
                            Title         = header,
                            Background    = null,
                            IsEnabled     = true
                        };
                    }
                    else if (m_selector is DocumentPane)
                    {
                        managedContent = new DocumentContent
                        {
                            Name       = Name,
                            Content    = newView,
                            Title      = header,
                            Background = null,
                            IsEnabled  = true
                        };
                        ((DocumentContent)managedContent).Closed += OnDocumentContentClosed;
                    }

                    if (managedContent != null)
                    {
                        m_viewToPaneMap.Add(newView, managedContent);
                        m_selector.Items.Add(managedContent);
                    }
                }
                else if (e.Action == NotifyCollectionChangedAction.Move)
                {
                }
                else if (e.Action == NotifyCollectionChangedAction.Reset)
                {
                }
                else if (e.Action == NotifyCollectionChangedAction.Remove)
                {
                }
                else if (e.Action == NotifyCollectionChangedAction.Replace)
                {
                }
            }
        }
        void FocusContent()
        {
            ManagedContent selectedContent = SelectedItem as ManagedContent;

            if (selectedContent != null && selectedContent.Content is UIElement)
            {
                //UIElement internalContent = selectedContent.Content as UIElement;
                //bool res = internalContent.Focus();
                selectedContent.SetAsActive();
            }
        }
Beispiel #9
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;
        }
Beispiel #10
0
        void NewVerticalTabGroup()
        {
            ManagedContent activeContent    = SelectedItem as ManagedContent;
            DocumentPane   newContainerPane = new DocumentPane();

            int indexOfDocumentInItsContainer = activeContent.ContainerPane.Items.IndexOf(activeContent);

            activeContent.ContainerPane.RemoveContent(indexOfDocumentInItsContainer);
            newContainerPane.Items.Add(activeContent);

            GetManager().Anchor(newContainerPane, this, AnchorStyle.Right);
        }
Beispiel #11
0
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            if (e.RemovedItems != null &&
                e.RemovedItems.Count > 0 &&
                e.AddedItems != null &&
                e.AddedItems.Count > 0)
            {
                _lastSelectedContent = e.RemovedItems[0] as ManagedContent;
            }

            base.OnSelectionChanged(e);
        }
Beispiel #12
0
        //static PaneTabPanel()
        //{
        //    //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
        //    //This style is defined in themes\generic.xaml
        //    DefaultStyleKeyProperty.OverrideMetadata(typeof(PaneTabPanel), new FrameworkPropertyMetadata(typeof(PaneTabPanel)));
        //}

        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            base.OnVisualChildrenChanged(visualAdded, visualRemoved);

            ManagedContent mc = visualAdded as ManagedContent;

            if (mc != null)
            {
                mc.Style = null;
                mc.Style = TabItemStyle;
            }
        }
Beispiel #13
0
        /// <summary>
        /// Move focus to pane content and activate it
        /// </summary>
        protected void FocusContent()
        {
            ManagedContent selectedContent = SelectedItem as ManagedContent;

            if (selectedContent != null)// && selectedContent.Content is UIElement)
            {
                //UIElement internalContent = selectedContent.Content as UIElement;
                //bool res = Focus();
                //Keyboard.Focus(internalContent);
                selectedContent.Activate();
            }
        }
        public override ManagedContent RemoveContent(int index)
        {
            ManagedContent content = base.RemoveContent(index);

            if (Items.Count == 0)
            {
                ResizingPanel containerPanel = Parent as ResizingPanel;
                if (containerPanel != null)
                {
                    containerPanel.RemoveChild(this);
                }
            }

            return(content);
        }
Beispiel #15
0
        public static object GetContent(this Pane pane, object obj)
        {
            ManagedContent content = (ManagedContent)pane.ItemContainerGenerator.ContainerFromItem(pane.SelectedItem);

            if (content == null && obj is ManagedContent)
            {
                content = obj as ManagedContent;
            }

            if (content != null)
            {
                return(content.Content);
            }

            return(null);
        }
        protected void OnLoaded(object sender, EventArgs e)
        {
            WindowInteropWrapper wih = new WindowInteropWrapper(this);

            //wih.WindowActivating += (s, ce) => ce.Cancel = true;//prevent window activating
            wih.FilterMessage += new EventHandler <FilterMessageEventArgs>(FilterMessage);

            if (HostedPane.Items.Count > 0)
            {
                ManagedContent cntHosted = HostedPane.Items[0] as ManagedContent;
                if (!cntHosted.IsCloseable)
                {
                    DisableXButton();
                }
            }
        }
Beispiel #17
0
        protected override void OnClosing(CancelEventArgs e)
        {
            if (HostedPane.Items.Count > 0 && !ForcedClosing)
            {
                ManagedContent cntToClose = HostedPane.Items[0] as ManagedContent;
                if (!cntToClose.IsCloseable)
                {
                    e.Cancel = true;
                    base.OnClosing(e);
                    return;
                }
            }

            IsClosing = true;
            base.OnClosing(e);
        }
Beispiel #18
0
        protected void OnLoaded(object sender, EventArgs e)
        {
            WindowInteropHelper helper = new WindowInteropHelper(this);

            _hwndSource     = HwndSource.FromHwnd(helper.Handle);
            _wndProcHandler = new HwndSourceHook(FilterMessage);
            _hwndSource.AddHook(_wndProcHandler);

            if (HostedPane.Items.Count > 0)
            {
                ManagedContent cntHosted = HostedPane.Items[0] as ManagedContent;
                if (!cntHosted.IsCloseable)
                {
                    DisableXButton();
                }
            }
        }
Beispiel #19
0
        internal override ManagedContent RemoveContent(int index)
        {
            ManagedContent  content         = base.RemoveContent(index);
            DockableContent dockableContent = content as DockableContent;

            if (((dockableContent == null) ||
                 (dockableContent != null && dockableContent.SavedStateAndPosition == null) ||
                 (dockableContent != null && dockableContent.SavedStateAndPosition.ContainerPane != this)) &&
                Items.Count == 0)
            {
                ResizingPanel containerPanel = Parent as ResizingPanel;
                if (containerPanel != null)
                {
                    containerPanel.RemoveChild(this);
                }
            }

            return(content);
        }
Beispiel #20
0
        public void ExecutedActivateDocumentCommand(object sender,
                                                    ExecutedRoutedEventArgs e)
        {
            ManagedContent doc = e.Parameter as ManagedContent;

            if (doc != null)
            {
                if (!DocumentTabPanel.GetIsHeaderVisible(doc))
                {
                    DocumentPane parentPane = doc.ContainerPane as DocumentPane;
                    parentPane.Items.Remove(doc);
                    parentPane.Items.Insert(0, doc);
                }
                ////doc.IsSelected = true;
                ////Selector.SetIsSelected(doc, true);
                //if (this.GetManager() != null)
                //    this.GetManager().ActiveContent = doc;
                doc.SetAsActive();
            }
        }
Beispiel #21
0
        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            base.OnVisualChildrenChanged(visualAdded, visualRemoved);

            ManagedContent mc = visualAdded as ManagedContent;

            if (mc != null)
            {
                if (mc.Style == null || mc.Style == DependencyProperty.UnsetValue)
                {
                    mc.Style = TabItemStyle;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(mc.Style.Setters.Count);
                }

                mc.ApplyTemplate();
            }
        }
Beispiel #22
0
        protected override void OnActivated(EventArgs e)
        {
            if (Manager != null)
            {
                lastActiveContent = Manager.ActiveContent;
                Manager.ActiveContent = HostedPane.SelectedItem as ManagedContent;
            }

            base.OnActivated(e);
        }
Beispiel #23
0
 internal NavigatorWindowItem(ManagedContent content)
 {
     _title = content.Title;
     _icon = content.Icon;
     _content = content;
 }
Beispiel #24
0
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            if (e.RemovedItems != null &&
                e.RemovedItems.Count > 0 &&
                e.AddedItems != null &&
                e.AddedItems.Count > 0)
                _lastSelectedContent = e.RemovedItems[0] as ManagedContent;

            base.OnSelectionChanged(e);
        }
Beispiel #25
0
        protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            DockingManager dockManager = GetManager();
            if (dockManager != null)
                dockManager.RefreshContents();

            if (e.NewItems != null)
                CheckItems(e.NewItems);

            HasSingleItem = (Items.Count == 1);

            if (_lastSelectedContent != null &&
                !Items.Contains(_lastSelectedContent))
                _lastSelectedContent = null;

            if ((e.NewItems == null || e.NewItems.Count == 0) &&
                (e.OldItems != null && e.OldItems.Count > 0 && e.OldItems.Contains(SelectedItem)))
            {
                if (_lastSelectedContent != null &&
                    Items.Contains(_lastSelectedContent))
                    SelectedItem = _lastSelectedContent;
            }

            //let base class handle SelectedIndex/Item value
            base.OnItemsChanged(e);

            if (Items.Count > 0)
            {
                int currentIndex = SelectedIndex;

                if (currentIndex < 0 ||
                    currentIndex >= Items.Count)
                    currentIndex = Items.Count - 1;

                SelectedItem = Items.GetItemAt(currentIndex);
            }

            RefreshContainsActiveContentProperty();

            if (Items.Count > 0)
            {
                var parentPanel = Parent as ResizingPanel;
                while (parentPanel != null && parentPanel.IsLoaded)
                {
                    parentPanel.UpdateLayout();
                    parentPanel.InvalidateMeasure();
                    parentPanel = parentPanel.Parent as ResizingPanel;
                }
            }
        }
Beispiel #26
0
        internal virtual ManagedContent RemoveContent(ManagedContent contentToRemove)
        {
            Items.Remove(contentToRemove);

            return contentToRemove;
        }
Beispiel #27
0
        internal virtual ManagedContent RemoveContent(ManagedContent contentToRemove)
        {
            Items.Remove(contentToRemove);

            return(contentToRemove);
        }
        protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e)
        {
            // The MouseLeave event can occur if the managed content was closed while the user held the left mouse button pressed.
            // In that case, this.IsLoaded will be false and we won't handle the event
            if (!e.Handled && isMouseDown && e.LeftButton == MouseButtonState.Pressed && Manager != null && this.IsLoaded)
            {
                if (!IsMouseCaptured)
                {
                    Point          ptMouseMove   = e.GetPosition((IInputElement)System.Windows.Media.VisualTreeHelper.GetParent(this));
                    ManagedContent contentToSwap = null;
                    if (ContainerPane != null)
                    {
                        foreach (ManagedContent content in ContainerPane.Items)
                        {
                            if (content == this)
                            {
                                continue;
                            }

                            HitTestResult res = VisualTreeHelper.HitTest(content, e.GetPosition(content));
                            if (res != null)
                            {
                                contentToSwap = content;
                                break;
                            }
                        }
                    }

                    if (contentToSwap != null &&
                        contentToSwap != this)
                    {
                        Pane containerPane = ContainerPane;
                        int  myIndex       = containerPane.Items.IndexOf(this);

                        ContainerPane.Items.RemoveAt(myIndex);

                        int otherIndex = containerPane.Items.IndexOf(contentToSwap);
                        containerPane.Items.RemoveAt(otherIndex);

                        containerPane.Items.Insert(otherIndex, this);

                        containerPane.Items.Insert(myIndex, contentToSwap);

                        containerPane.SelectedItem = this;

                        e.Handled = false;
                        //avoid ismouseDown = false call
                        return;
                    }
                    else if (Math.Abs(ptMouseMove.X - StartDragPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
                             Math.Abs(ptMouseMove.Y - StartDragPoint.Y) > SystemParameters.MinimumVerticalDragDistance)
                    {
                        ptRelativePosition = e.GetPosition(DragEnabledArea);

                        ResetIsMouseDownFlag();
                        OnDragStart(StartDragPoint, ptRelativePosition);
                        e.Handled = true;
                    }
                }
            }

            ResetIsMouseDownFlag();
        }
        protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e)
        {
            if (!e.Handled && IsMouseDown && Manager != null)
            {
                if (!IsMouseCaptured)
                {
                    Point          ptMouseMove   = e.GetPosition(this);
                    ManagedContent contentToSwap = null;
                    if (ContainerPane != null)
                    {
                        foreach (ManagedContent content in ContainerPane.Items)
                        {
                            if (content == this)
                            {
                                continue;
                            }

                            HitTestResult res = VisualTreeHelper.HitTest(content, e.GetPosition(content));
                            if (res != null)
                            {
                                contentToSwap = content;
                                break;
                            }
                        }
                    }



                    if (contentToSwap != null)
                    {
                        Pane containerPane = ContainerPane;
                        int  myIndex       = containerPane.Items.IndexOf(this);

                        ContainerPane.Items.RemoveAt(myIndex);

                        int otherIndex = containerPane.Items.IndexOf(contentToSwap);
                        containerPane.Items.RemoveAt(otherIndex);

                        containerPane.Items.Insert(otherIndex, this);

                        containerPane.Items.Insert(myIndex, contentToSwap);

                        containerPane.SelectedItem = this;

                        e.Handled = false;
                        return;
                    }
                    else if (Math.Abs(ptMouseMove.X - StartDragPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
                             Math.Abs(ptMouseMove.Y - StartDragPoint.Y) > SystemParameters.MinimumVerticalDragDistance)
                    {
                        ptRelativePosition = e.GetPosition(DragEnabledArea);

                        ResetIsMouseDownFlag();
                        OnDragStart(StartDragPoint, ptRelativePosition);
                        e.Handled = true;
                    }
                }
            }

            isMouseDown = false;
        }
Beispiel #30
0
        internal virtual ManagedContent RemoveContent(int index)
        {
            ManagedContent contentToRemove = Items[index] as ManagedContent;

            return(RemoveContent(contentToRemove));
        }
Beispiel #31
0
 internal NavigatorWindowItem(ManagedContent content)
 {
     _title   = content.Title;
     _icon    = content.Icon;
     _content = content;
 }
Beispiel #32
0
        void CloseThis(ManagedContent contentToClose)
        {
            if (GetManager() == null)
                return;

            if (contentToClose == null)
                contentToClose = SelectedItem as ManagedContent;

            DockableContent dockableContent = contentToClose as DockableContent;

            if (dockableContent != null)
                dockableContent.Close();
            else
            {
                DocumentContent documentContent = contentToClose as DocumentContent;
                documentContent.Close();
            }

        }
Beispiel #33
0
        protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            DockingManager dockManager = GetManager();

            if (dockManager != null)
            {
                dockManager.RefreshContents();
            }

            if (e.NewItems != null)
            {
                CheckItems(e.NewItems);
            }

            HasSingleItem = (Items.Count == 1);

            if (_lastSelectedContent != null &&
                !Items.Contains(_lastSelectedContent))
            {
                _lastSelectedContent = null;
            }

            if ((e.NewItems == null || e.NewItems.Count == 0) &&
                (e.OldItems != null && e.OldItems.Count > 0))
            {
                if (_lastSelectedContent != null &&
                    Items.Contains(_lastSelectedContent))
                {
                    SelectedItem = _lastSelectedContent;
                }
            }

            //let base class handle SelectedIndex/Item value
            base.OnItemsChanged(e);

            if (Items.Count > 0)
            {
                int currentIndex = SelectedIndex;

                if (currentIndex < 0 ||
                    currentIndex >= Items.Count)
                {
                    currentIndex = Items.Count - 1;
                }

                SelectedItem = Items.GetItemAt(currentIndex);
            }

            RefreshContainsActiveContentProperty();

            if (Items.Count > 0)
            {
                var parentPanel = Parent as ResizingPanel;
                while (parentPanel != null && parentPanel.IsLoaded)
                {
                    parentPanel.UpdateLayout();
                    parentPanel.InvalidateMeasure();
                    parentPanel = parentPanel.Parent as ResizingPanel;
                }
            }
        }
Beispiel #34
0
 private static void setManagedContentProperties(ILayoutItem layoutItem, ManagedContent content)
 {
     content.Content = layoutItem;
     content.Title = layoutItem.Title;
     content.Name = layoutItem.Name;
     content.Icon = layoutItem.Icon;
 }
Beispiel #35
0
        protected override void OnInitialized(EventArgs e)
        {
            if (_paneToTransfer != null)
            {
                //setup window size
                ManagedContent 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;
                }

                int selectedIndex = _paneToTransfer.SelectedIndex;

                //remove contents from container pane and insert in hosted pane
                while (_paneToTransfer.Items.Count > 0)
                {
                    DockableContent 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);

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


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

            base.OnInitialized(e);
        }
Beispiel #36
0
 public void BringToFront(ManagedContent doc)
 {
     if (!DocumentTabPanel.GetIsHeaderVisible(doc))
     {
         DocumentPane parentPane = doc.ContainerPane as DocumentPane;
         bool sel = parentPane.SelectedItem == doc;
         parentPane.Items.Remove(doc);
         parentPane.Items.Insert(0, doc);
         if (sel) parentPane.SelectedItem = doc;
     }
 }