当前位置: 首页>>代码示例>>C#>>正文


C# DocumentPane.GetParentDocumentPaneResizingPanel方法代码示例

本文整理汇总了C#中AvalonDock.DocumentPane.GetParentDocumentPaneResizingPanel方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentPane.GetParentDocumentPaneResizingPanel方法的具体用法?C# DocumentPane.GetParentDocumentPaneResizingPanel怎么用?C# DocumentPane.GetParentDocumentPaneResizingPanel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AvalonDock.DocumentPane的用法示例。


在下文中一共展示了DocumentPane.GetParentDocumentPaneResizingPanel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Anchor

        /// <summary>
        /// Anchor a document pane (<see cref="DocumentPane"/>) to a border of an other document pane
        /// </summary>
        /// <param name="paneToAnchor">Pane to anchor</param>
        /// <param name="relativePane">Pane relative</param>
        /// <param name="anchor"></param>
        public void Anchor(DocumentPane paneToAnchor, DocumentPane relativePane, AnchorStyle anchor)
        {
            //ensure that content property is not empty
            EnsureContentNotEmpty();

            if (anchor == AnchorStyle.None)
                anchor = AnchorStyle.Right;

            //get a reference to the resizingpanel container of relativePane
            ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel;
            DocumentPaneResizingPanel relativeDocumentPaneContainer = relativePane.GetParentDocumentPaneResizingPanel();
            Orientation requestedOrientation =
                (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal;

            if (relativePaneContainer == null)
            {
                Debug.Assert(relativePane.Parent == this);

                relativeDocumentPaneContainer = new DocumentPaneResizingPanel();
                relativePaneContainer = relativeDocumentPaneContainer;

                relativeDocumentPaneContainer.Orientation = requestedOrientation;
                this.Content = relativePaneContainer;

                relativePaneContainer.Children.Add(relativePane);

            }

            if (relativeDocumentPaneContainer == null)
            {
                relativeDocumentPaneContainer = new DocumentPaneResizingPanel();
                relativeDocumentPaneContainer.Orientation = requestedOrientation;

                int indexOfPaneToReplace = relativePaneContainer.Children.IndexOf(relativePane);
                relativePaneContainer.Children.RemoveAt(indexOfPaneToReplace);

                relativeDocumentPaneContainer.Children.Add(relativePane);

                relativePaneContainer.Children.Insert(indexOfPaneToReplace, relativeDocumentPaneContainer);

                relativePaneContainer = relativeDocumentPaneContainer;
            }

            Debug.Assert(relativePaneContainer != null, "By now we can't have a pane without a resizing panel containing it");

            #region Create and setup container panel
            if (relativePaneContainer != null)
            {
                //check if orientation is right
                if (relativePaneContainer.Orientation != requestedOrientation)
                {
                    //if the existing panel is not oriented as we want
                    //create a new one
                    DocumentPaneResizingPanel newPanel = new DocumentPaneResizingPanel();
                    newPanel.Orientation = requestedOrientation;

                    //replace relative pane in its' container panel
                    //with this new panel
                    int indexofRelativePane = relativePaneContainer.Children.IndexOf(relativePane);
                    relativePaneContainer.Children.Remove(relativePane);
                    relativePaneContainer.Children.Insert(indexofRelativePane, newPanel);

                    //now we have a panel correctly placed in the tree
                    newPanel.Children.Add(relativePane);

                    //use InsertChildRelativeTo function to add a resizingsplitter between
                    //the two children
                    newPanel.InsertChildRelativeTo(
                        paneToAnchor, relativePane, anchor == AnchorStyle.Right || anchor == AnchorStyle.Bottom);

                    relativePaneContainer = newPanel;
                }
                else
                {
                    if (anchor == AnchorStyle.Left ||
                        anchor == AnchorStyle.Top)
                    {
                        //add new child before first (prepend)
                        relativePaneContainer.InsertChildRelativeTo(paneToAnchor,
                            relativePane, false);
                    }
                    else
                    {
                        //add new child after last (append)
                        relativePaneContainer.InsertChildRelativeTo(paneToAnchor,
                            relativePane, true);
                    }

                    //if (relativePaneContainer.Orientation == Orientation.Horizontal)
                    //{
                    //    Size desideredSize = ResizingPanel.GetEffectiveSize(paneToAnchor);
                    //    double approxStarForNewPane = desideredSize.Width / relativePaneContainer.ActualWidth;
                    //    approxStarForNewPane = Math.Min(approxStarForNewPane, 1.0);
                    //    paneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(approxStarForNewPane, GridUnitType.Star));
//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs


注:本文中的AvalonDock.DocumentPane.GetParentDocumentPaneResizingPanel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。