/// <summary>
        /// Handles the referencedContent property changes in order to update the Anchor property
        /// </summary>
        /// <param name="depObj"></param>
        /// <param name="e"></param>
        static void OnPaneAttached(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            //Update Anchor, Title and Icon property
            DockablePaneAnchorTab _this = depObj as DockablePaneAnchorTab;

            _this.SetAnchor(((DockablePane)_this.ReferencedContent.ContainerPane).Anchor);
            _this.SetIcon(_this.ReferencedContent.Icon);
            _this.SetTitle(_this.ReferencedContent.Title);
        }
Пример #2
0
 static void OnPaneAttached(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
 {
     if (e.Property == ReferencedContentPropertyKey.DependencyProperty)
     {
         DockablePaneAnchorTab _this = depObj as DockablePaneAnchorTab;
         if (_this.PropertyChanged != null)
         {
             _this.PropertyChanged(depObj, new PropertyChangedEventArgs("Anchor"));
             _this.PropertyChanged(depObj, new PropertyChangedEventArgs("Icon"));
             _this.PropertyChanged(depObj, new PropertyChangedEventArgs("ReferencedContent"));
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Handles the referencedContent property changes in order to update the Anchor property
        /// </summary>
        /// <param name="depObj"></param>
        /// <param name="e"></param>
        static void OnPaneAttached(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            //Update Anchor, Title and Icon property
            DockablePaneAnchorTab _this = depObj as DockablePaneAnchorTab;

            _this.SetAnchor(((DockablePane)_this.ReferencedContent.ContainerPane).Anchor);
            _this.SetIcon(_this.ReferencedContent.Icon);

            //Update by yohan, sync title with anchor tab and content.
            Binding bind = new Binding("Title");

            bind.Source = _this.ReferencedContent;
            _this.SetBinding(DockablePaneAnchorTab.TitleProperty, bind);
            //_this.SetTitle(_this.ReferencedContent.Title);
        }
Пример #4
0
        /// <summary>
        /// Autohides/redock a dockable pane
        /// </summary>
        /// <param name="pane">Pane to auto hide/redock</param>
        internal void ToggleAutoHide(DockablePane pane)
        {
            if (!_OnApplyTemplateFlag)
            {
                Debug.WriteLine("Layout has been restored before creating DockingManager object: force WPF to apply the template...");
                ApplyTemplate();
            }

            //if pane is in auto hide state then is found
            //referenced by a DockablePaneAnchorTabGroup
            //if so redock it in its original position
            if (RemovePaneFromTabGroups(pane))
            {
                #region Pane is present in tab anchor panels
                DockableContent selectedContent =
                    _flyoutWindow != null &&
                    _flyoutWindow.ReferencedPane != null &&
                    _flyoutWindow.ReferencedPane.Items.Count > 0 ? _flyoutWindow.ReferencedPane.Items[0] as DockableContent :
                    pane.Items[0] as DockableContent;

                HideFlyoutWindow();

                ResizingPanel parentPanel = pane.Parent as ResizingPanel;
                if (parentPanel != null && parentPanel.Children.Count >= 3)
                {
                    parentPanel.AdjustPanelSizes();
                }

                //reset content state to docked
                foreach (DockableContent content in pane.Items)
                {
                    content.SetStateToDock();
                }

                pane.Focus();
                pane.SelectedItem = selectedContent;
                ActiveContent = selectedContent;
                #endregion
            }
            else
            {
                #region Pane is not auto hidden
                //Create e new group
                DockablePaneAnchorTabGroup group = new DockablePaneAnchorTabGroup();

                //associate it to the pane
                group.ReferencedPane = pane;

                DockableContent selectedContent = pane.SelectedItem as DockableContent;

                //add contents to it
                foreach (DockableContent content in pane.Items)
                {
                    DockablePaneAnchorTab tab = new DockablePaneAnchorTab();
                    tab.ReferencedContent = content;
                    //tab.Anchor = pane.Anchor;
                    //tab.Icon = content.Icon;

                    group.Children.Add(tab);
                    content.SetStateToAutoHide();
                }

                //place group under correct anchor tabpanel
                switch (pane.Anchor)
                {
                    case AnchorStyle.Left:
                        if (_leftAnchorTabPanel != null)
                            _leftAnchorTabPanel.Children.Add(group);
                        break;
                    case AnchorStyle.Top:
                        if (_topAnchorTabPanel != null)
                            _topAnchorTabPanel.Children.Add(group);
                        break;
                    case AnchorStyle.Right:
                        if (_rightAnchorTabPanel != null)
                            _rightAnchorTabPanel.Children.Add(group);
                        break;
                    case AnchorStyle.Bottom:
                        if (_bottomAnchorTabPanel != null)
                            _bottomAnchorTabPanel.Children.Add(group);
                        break;
                }

                #endregion
            }

            //refresh arrangements traversing bottom-up visual tree
            FrameworkElement parentElement = pane.Parent as FrameworkElement;

            while (parentElement != null)
            {
                parentElement.InvalidateMeasure();
                parentElement = parentElement.Parent as FrameworkElement;
            }
        }
Пример #5
0
        /// <summary>
        /// Shows a flyout window for a content
        /// </summary>
        /// <param name="content">Content to show</param>
        internal void ShowFlyoutWindow(DockableContent content, DockablePaneAnchorTab tabActivating)
        {
            //check if parent window is Active
            Window parentWindow = Window.GetWindow(this);
            if (parentWindow == null || !parentWindow.IsVisible)
                return;

            if (!parentWindow.IsActive && (_flyoutWindow == null || !_flyoutWindow.IsActive))
                return;

            //check if content is already visible in a flyout window
            if (_flyoutWindow != null &&
                _flyoutWindow.ReferencedPane.Items.Contains(content))
            {
                //continue to show the winow
                //_flyoutWindow.KeepWindowOpen();
                return;
            }

            //hide previous window
            HideFlyoutWindow();

            //select this content in the referenced pane
            content.ContainerPane.SelectedItem = content;

            if (_wndInteropWrapper == null)
            {
                _wndInteropWrapper = new WindowInteropWrapper(parentWindow);
                _wndInteropWrapper.WindowPosChanging += (s, e) =>
                    {
                        //update the flyout window
                        UpdateFlyoutWindowPosition();
                    };
            }

            //create e new window
            _flyoutWindow = new FlyoutPaneWindow(this, content);
            _flyoutWindow.Owner = parentWindow;
            _flyoutWindow.FlowDirection = this.FlowDirection;
            _flyoutWindow.ShowActivated = false;
            _flyoutWindow.AnchorTabActivating = tabActivating;

            UpdateFlyoutWindowPosition(true);

            _flyoutWindow.Closing += new System.ComponentModel.CancelEventHandler(OnFlyoutWindowClosing);
            _flyoutWindow.Show();

            //this.Focus();
        }
Пример #6
0
        /// <summary>
        /// Shows a flyout window for a content
        /// </summary>
        /// <param name="content">Content to show</param>
        internal void ShowFlyoutWindow(DockableContent content, DockablePaneAnchorTab tabActivating)
        {
            //check if parent window is Active
            Window parentWindow = Window.GetWindow(this);
            if (parentWindow == null || !parentWindow.IsVisible)
                return;
            
            if (!parentWindow.IsActive && (_flyoutWindow == null || !_flyoutWindow.IsActive))
                return;

            //check if content is already visible in a flyout window
            if (_flyoutWindow != null &&
                _flyoutWindow.ReferencedPane.Items.Contains(content))
            {
                //continue to show the winow
                //_flyoutWindow.KeepWindowOpen();
                return;
            }
            
            // David: This sometimes seems to be null when hovering over auto-hide pad.
            // It only seems to occur in specific circumstances - whether the pad is the
            // "selected" one in the set seems important.  Having no open document might have effect?
            // I have only managed to reliablely reproduce it in stand-alone application.
			if (content.ContainerPane == null)
			{
				return;
			}

            //hide previous window
            HideFlyoutWindow();

            //select this content in the referenced pane
            content.ContainerPane.SelectedItem = content;

            if (_wndInteropWrapper == null)
            {
                _wndInteropWrapper = new WindowInteropWrapper(parentWindow);
                _wndInteropWrapper.WindowPosChanging += (s, e) =>
                    {
                        //update the flyout window
                        UpdateFlyoutWindowPosition();
                    };
            }

            //create e new window
            _flyoutWindow = new FlyoutPaneWindow(this, content);
            _flyoutWindow.Owner = parentWindow;
            _flyoutWindow.FlowDirection = this.FlowDirection;
            _flyoutWindow.ShowActivated = false;
            _flyoutWindow.AnchorTabActivating = tabActivating;
            
            UpdateFlyoutWindowPosition(true);

            _flyoutWindow.Closing += new System.ComponentModel.CancelEventHandler(OnFlyoutWindowClosing);
            _flyoutWindow.Show();

            //this.Focus();
        }