コード例 #1
0
 public LayoutAnchorablePaneGroup(LayoutAnchorablePane firstChild)
 {
     Children.Add(firstChild);
 }
コード例 #2
0
        public void ToggleAutoHide()
        {
            #region Anchorable is already auto hidden
            if (IsAutoHidden)
            {
                var parentGroup       = Parent as LayoutAnchorGroup;
                var parentSide        = parentGroup.Parent as LayoutAnchorSide;
                var previousContainer = ((ILayoutPreviousContainer)parentGroup).PreviousContainer as LayoutAnchorablePane;

                if (previousContainer == null)
                {
                    AnchorSide side = (parentGroup.Parent as LayoutAnchorSide).Side;
                    switch (side)
                    {
                    case AnchorSide.Right:
                        if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal)
                        {
                            previousContainer = new LayoutAnchorablePane();
                            previousContainer.DockMinWidth = this.AutoHideMinWidth;
                            parentGroup.Root.RootPanel.Children.Add(previousContainer);
                        }
                        else
                        {
                            previousContainer = new LayoutAnchorablePane();
                            LayoutPanel panel = new LayoutPanel()
                            {
                                Orientation = Orientation.Horizontal
                            };
                            LayoutRoot  root         = parentGroup.Root as LayoutRoot;
                            LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel;
                            root.RootPanel = panel;
                            panel.Children.Add(oldRootPanel);
                            panel.Children.Add(previousContainer);
                        }
                        break;

                    case AnchorSide.Left:
                        if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal)
                        {
                            previousContainer = new LayoutAnchorablePane();
                            previousContainer.DockMinWidth = this.AutoHideMinWidth;
                            parentGroup.Root.RootPanel.Children.Insert(0, previousContainer);
                        }
                        else
                        {
                            previousContainer = new LayoutAnchorablePane();
                            LayoutPanel panel = new LayoutPanel()
                            {
                                Orientation = Orientation.Horizontal
                            };
                            LayoutRoot  root         = parentGroup.Root as LayoutRoot;
                            LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel;
                            root.RootPanel = panel;
                            panel.Children.Add(previousContainer);
                            panel.Children.Add(oldRootPanel);
                        }
                        break;

                    case AnchorSide.Top:
                        if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical)
                        {
                            previousContainer = new LayoutAnchorablePane();
                            previousContainer.DockMinHeight = this.AutoHideMinHeight;
                            parentGroup.Root.RootPanel.Children.Insert(0, previousContainer);
                        }
                        else
                        {
                            previousContainer = new LayoutAnchorablePane();
                            LayoutPanel panel = new LayoutPanel()
                            {
                                Orientation = Orientation.Vertical
                            };
                            LayoutRoot  root         = parentGroup.Root as LayoutRoot;
                            LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel;
                            root.RootPanel = panel;
                            panel.Children.Add(previousContainer);
                            panel.Children.Add(oldRootPanel);
                        }
                        break;

                    case AnchorSide.Bottom:
                        if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical)
                        {
                            previousContainer = new LayoutAnchorablePane();
                            previousContainer.DockMinHeight = this.AutoHideMinHeight;
                            parentGroup.Root.RootPanel.Children.Add(previousContainer);
                        }
                        else
                        {
                            previousContainer = new LayoutAnchorablePane();
                            LayoutPanel panel = new LayoutPanel()
                            {
                                Orientation = Orientation.Vertical
                            };
                            LayoutRoot  root         = parentGroup.Root as LayoutRoot;
                            LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel;
                            root.RootPanel = panel;
                            panel.Children.Add(oldRootPanel);
                            panel.Children.Add(previousContainer);
                        }
                        break;
                    }
                }
                else
                {
                    //I'm about to remove parentGroup, redirect any content (ie hidden contents) that point to it
                    //to previousContainer
                    LayoutRoot root = parentGroup.Root as LayoutRoot;
                    foreach (var cnt in root.Descendents().OfType <ILayoutPreviousContainer>().Where(c => c.PreviousContainer == parentGroup))
                    {
                        cnt.PreviousContainer = previousContainer;
                    }
                }

                foreach (var anchorableToToggle in parentGroup.Children.ToArray())
                {
                    previousContainer.Children.Add(anchorableToToggle);
                }

                parentSide.Children.Remove(parentGroup);

                var parent = previousContainer.Parent as LayoutGroupBase;
                while ((parent != null))
                {
                    if (parent is LayoutGroup <ILayoutPanelElement> )
                    {
                        ((LayoutGroup <ILayoutPanelElement>)parent).ComputeVisibility();
                    }
                    parent = parent.Parent as LayoutGroupBase;
                }
            }
            #endregion

            #region Anchorable is docked
            else if (Parent is LayoutAnchorablePane)
            {
                var root       = Root;
                var parentPane = Parent as LayoutAnchorablePane;

                var newAnchorGroup = new LayoutAnchorGroup();

                ((ILayoutPreviousContainer)newAnchorGroup).PreviousContainer = parentPane;

                foreach (var anchorableToImport in parentPane.Children.ToArray())
                {
                    newAnchorGroup.Children.Add(anchorableToImport);
                }

                //detect anchor side for the pane
                var anchorSide = parentPane.GetSide();

                switch (anchorSide)
                {
                case AnchorSide.Right:
                    if (root.RightSide != null)
                    {
                        root.RightSide.Children.Add(newAnchorGroup);
                    }
                    break;

                case AnchorSide.Left:
                    if (root.LeftSide != null)
                    {
                        root.LeftSide.Children.Add(newAnchorGroup);
                    }
                    break;

                case AnchorSide.Top:
                    if (root.TopSide != null)
                    {
                        root.TopSide.Children.Add(newAnchorGroup);
                    }
                    break;

                case AnchorSide.Bottom:
                    if (root.BottomSide != null)
                    {
                        root.BottomSide.Children.Add(newAnchorGroup);
                    }
                    break;
                }
            }
            #endregion
        }
コード例 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.toolsGroup = ((Fluent.RibbonContextualTabGroup)(target));
                return;

            case 2:
                this.buttonLoad = ((Fluent.Button)(target));

            #line 20 "..\..\..\MainWindow.xaml"
                this.buttonLoad.Click += new System.Windows.RoutedEventHandler(this.bookLoadButton_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.buttonSetting = ((Fluent.Button)(target));

            #line 22 "..\..\..\MainWindow.xaml"
                this.buttonSetting.Click += new System.Windows.RoutedEventHandler(this.buttonSetting_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.explorerLoad = ((Fluent.Button)(target));

            #line 23 "..\..\..\MainWindow.xaml"
                this.explorerLoad.Click += new System.Windows.RoutedEventHandler(this.explorerLoad_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.AddNewInstBtn_ = ((Fluent.Button)(target));

            #line 24 "..\..\..\MainWindow.xaml"
                this.AddNewInstBtn_.Click += new System.Windows.RoutedEventHandler(this.AddNewInstBtn__Click);

            #line default
            #line hidden
                return;

            case 6:
                this.BatchControlBtn_ = ((Fluent.Button)(target));

            #line 25 "..\..\..\MainWindow.xaml"
                this.BatchControlBtn_.Click += new System.Windows.RoutedEventHandler(this.BatchControlBtn_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.MROPositionLoadBtn_ = ((Fluent.Button)(target));

            #line 26 "..\..\..\MainWindow.xaml"
                this.MROPositionLoadBtn_.Click += new System.Windows.RoutedEventHandler(this.MROPositionLoadBtn_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.DeltaHedgeMonitorBtn_ = ((Fluent.Button)(target));

            #line 27 "..\..\..\MainWindow.xaml"
                this.DeltaHedgeMonitorBtn_.Click += new System.Windows.RoutedEventHandler(this.DeltaHedgeMonitorBtn_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.ResualtDocking = ((AvalonDock.DockingManager)(target));
                return;

            case 10:
                this.DocumentPaneGroup_ = ((AvalonDock.Layout.LayoutDocumentPaneGroup)(target));
                return;

            case 11:
                this.DocumentPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target));
                return;

            case 12:
                this.StartDocument_ = ((AvalonDock.Layout.LayoutDocument)(target));
                return;

            case 13:
                this.ouputPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target));
                return;

            case 14:
                this.ExplorerPaneGroup = ((AvalonDock.Layout.LayoutAnchorablePaneGroup)(target));
                return;

            case 15:
                this.ExplorerPortfolio_ = ((AvalonDock.Layout.LayoutAnchorablePane)(target));
                return;
            }
            this._contentLoaded = true;
        }
コード例 #4
0
        protected override void InternalDock()
        {
            var root = Root as LayoutRoot;
            LayoutAnchorablePane anchorablePane = null;

            if (root.ActiveContent != null &&
                root.ActiveContent != this)
            {
                //look for active content parent pane
                anchorablePane = root.ActiveContent.Parent as LayoutAnchorablePane;
            }

            if (anchorablePane == null)
            {
                //look for a pane on the right side
                anchorablePane = root.Descendents().OfType <LayoutAnchorablePane>().Where(pane => !pane.IsHostedInFloatingWindow && pane.GetSide() == AnchorSide.Right).FirstOrDefault();
            }

            if (anchorablePane == null)
            {
                //look for an available pane
                anchorablePane = root.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault();
            }


            bool added = false;

            if (root.Manager.LayoutUpdateStrategy != null)
            {
                added = root.Manager.LayoutUpdateStrategy.BeforeInsertAnchorable(root, this, anchorablePane);
            }

            if (!added)
            {
                if (anchorablePane == null)
                {
                    var mainLayoutPanel = new LayoutPanel()
                    {
                        Orientation = Orientation.Horizontal
                    };
                    if (root.RootPanel != null)
                    {
                        mainLayoutPanel.Children.Add(root.RootPanel);
                    }

                    root.RootPanel = mainLayoutPanel;
                    anchorablePane = new LayoutAnchorablePane()
                    {
                        DockWidth = new GridLength(200.0, GridUnitType.Pixel)
                    };
                    mainLayoutPanel.Children.Add(anchorablePane);
                }

                anchorablePane.Children.Add(this);
                added = true;
            }

            if (root.Manager.LayoutUpdateStrategy != null)
            {
                root.Manager.LayoutUpdateStrategy.AfterInsertAnchorable(root, this);
            }

            base.InternalDock();
        }
コード例 #5
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.toolsGroup = ((Fluent.RibbonContextualTabGroup)(target));
     return;
     case 2:
     this.buttonLoad = ((Fluent.Button)(target));
     
     #line 20 "..\..\..\MainWindow.xaml"
     this.buttonLoad.Click += new System.Windows.RoutedEventHandler(this.bookLoadButton_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     this.buttonSetting = ((Fluent.Button)(target));
     
     #line 22 "..\..\..\MainWindow.xaml"
     this.buttonSetting.Click += new System.Windows.RoutedEventHandler(this.buttonSetting_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this.explorerLoad = ((Fluent.Button)(target));
     
     #line 23 "..\..\..\MainWindow.xaml"
     this.explorerLoad.Click += new System.Windows.RoutedEventHandler(this.explorerLoad_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.AddNewInstBtn_ = ((Fluent.Button)(target));
     
     #line 24 "..\..\..\MainWindow.xaml"
     this.AddNewInstBtn_.Click += new System.Windows.RoutedEventHandler(this.AddNewInstBtn__Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.BatchControlBtn_ = ((Fluent.Button)(target));
     
     #line 25 "..\..\..\MainWindow.xaml"
     this.BatchControlBtn_.Click += new System.Windows.RoutedEventHandler(this.BatchControlBtn_Click);
     
     #line default
     #line hidden
     return;
     case 7:
     this.MROPositionLoadBtn_ = ((Fluent.Button)(target));
     
     #line 26 "..\..\..\MainWindow.xaml"
     this.MROPositionLoadBtn_.Click += new System.Windows.RoutedEventHandler(this.MROPositionLoadBtn_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.DeltaHedgeMonitorBtn_ = ((Fluent.Button)(target));
     
     #line 27 "..\..\..\MainWindow.xaml"
     this.DeltaHedgeMonitorBtn_.Click += new System.Windows.RoutedEventHandler(this.DeltaHedgeMonitorBtn_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.ResualtDocking = ((AvalonDock.DockingManager)(target));
     return;
     case 10:
     this.DocumentPaneGroup_ = ((AvalonDock.Layout.LayoutDocumentPaneGroup)(target));
     return;
     case 11:
     this.DocumentPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target));
     return;
     case 12:
     this.StartDocument_ = ((AvalonDock.Layout.LayoutDocument)(target));
     return;
     case 13:
     this.ouputPane_ = ((AvalonDock.Layout.LayoutDocumentPane)(target));
     return;
     case 14:
     this.ExplorerPaneGroup = ((AvalonDock.Layout.LayoutAnchorablePaneGroup)(target));
     return;
     case 15:
     this.ExplorerPortfolio_ = ((AvalonDock.Layout.LayoutAnchorablePane)(target));
     return;
     }
     this._contentLoaded = true;
 }