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


C# AvalonDock.DockableContent类代码示例

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


DockableContent类属于AvalonDock命名空间,在下文中一共展示了DockableContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FlyoutDockablePane

        public FlyoutDockablePane(DockableContent content)
        {
            _referencedPane = content.ContainerPane as DockablePane;
            _manager = _referencedPane.GetManager();

            //save current content position in container pane
            _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content);
            Anchor = _referencedPane.Anchor;

            SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width));
            SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height));


            //if (double.IsInfinity(ResizingPanel.GetResizeWidth(this)))
            //    ResizingPanel.SetResizeWidth(this, 200);
            //if (double.IsInfinity(ResizingPanel.GetResizeHeight(this)))
            //    ResizingPanel.SetResizeHeight(this, 200);

            this.Style = _referencedPane.Style;

            //remove content from container pane
            //and add content to my temporary pane
            _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane);
            this.Items.Add(content);


            //select the single content in this pane
            SelectedItem = this.Items[0];
        }
开发者ID:Reticulatas,项目名称:AvalonDock,代码行数:29,代码来源:FlyoutDockablePane.cs

示例2: RemovePane

        public void RemovePane(DockableContent content)
        {
            if (this.DockableContents.Contains(content))
                this.DockableContents.Remove(content);

            
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:7,代码来源:DockingManager.cs

示例3: BuildDockingLayout

        void BuildDockingLayout()
        {
            dockManager.Content = null;

            //TreeView dockable content
            var trv = new TreeView();
            trv.Items.Add(new TreeViewItem() { Header = "Item1" });
            trv.Items.Add(new TreeViewItem() { Header = "Item2" });
            trv.Items.Add(new TreeViewItem() { Header = "Item3" });
            trv.Items.Add(new TreeViewItem() { Header = "Item4" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem1" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem2" });
            ((TreeViewItem)trv.Items[1]).Items.Add(new TreeViewItem() { Header = "SubItem3" });
            ((TreeViewItem)trv.Items[2]).Items.Add(new TreeViewItem() { Header = "SubItem4" });
            var treeviewContent = new DockableContent() { Title = "Explorer", Content = trv };

            treeviewContent.Show(dockManager, AnchorStyle.Bottom);

            //TextBox invo dockable content
            var treeviewInfoContent = new DockableContent() { Title = "Explorer Info", Content = new TextBox() { Text = "Explorer Info Text", IsReadOnly = true } };
            treeviewContent.ContainerPane.Items.Add(treeviewInfoContent);

            //ListView dockable content
            var gridView = new GridView();
            gridView.Columns.Add(new GridViewColumn() { Header = "Date" });
            gridView.Columns.Add(new GridViewColumn() { Header = "Day Of Weeek", DisplayMemberBinding = new Binding("DayOfWeek") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Year", DisplayMemberBinding = new Binding("Year") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Month", DisplayMemberBinding = new Binding("Month") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Second", DisplayMemberBinding = new Binding("Second") });
            var listView = new ListView() { View = gridView };
            listView.Items.Add(DateTime.Now);
            listView.Items.Add(DateTime.Now.AddYears(-1));
            listView.Items.Add(DateTime.Now.AddMonths(15));
            listView.Items.Add(DateTime.Now.AddHours(354));

            var listViewContent = new DockableContent() { Title = "Date & Times", Content = listView };
            listViewContent.ShowAsFloatingWindow(dockManager, true);

            //TextBox dockable content
            var textboxSampleContent = new DockableContent() { Title = "Date & Times Info", Content = new TextBox() { Text = "Date & Times Info Text", IsReadOnly = true } };
            listViewContent.ContainerPane.Items.Add(textboxSampleContent);

            //DataGrid document
            //var dataGrid = new DataGrid();
            //var rnd = new Random();
            //var data = new List<Tuple<double, double, double, double>>();
            //for (int i = 0; i < 100; i++)
            //{
            //    data.Add(Tuple.Create(rnd.NextDouble(), rnd.NextDouble() * 10.0, rnd.NextDouble() * 100.0, rnd.NextDouble() * 1000.0));
            //}

            //dataGrid.ItemsSource = data;

            //var dataGridDocument = new DocumentContent() { Title = "Data", IsLocked = true, Content = dataGrid };
            //dataGridDocument.Show(dockManager);

            ////DataGrid Info Text sample
            //var dataGridInfoContent = new DockableContent() { Title = "Data Info", Content = new TextBox() { Text = "Data Info Text" } };
            //dataGridInfoContent.ShowAsDocument(dockManager);
        }
开发者ID:JeremyDurnell,项目名称:ChromeTabs,代码行数:60,代码来源:MainWindow.xaml.cs

示例4: doTest

        private void doTest(object sender, RoutedEventArgs e)
        {
            DocumentPane pane = (Application.Current as IAppTemplate).RequestDockingPoint<DocumentPane>(this) as DocumentPane;

             DockableContent dc = new DockableContent();
             dc.Title = "API View";

             APITestDialog dlg = new APITestDialog();
             dc.Content = dlg;

             pane.Items.Add(dc);
             dc.Focus();
        }
开发者ID:Joeeigel,项目名称:eve-net,代码行数:13,代码来源:APITestPlugin.cs

示例5: doTest

        private void doTest(object sender, RoutedEventArgs e)
        {
            DocumentPane pane = (Application.Current as IAppTemplate).RequestDockingPoint<DocumentPane>(this) as DocumentPane;

               DockableContent dc = new DockableContent();
               dc.Title = "Corp Wallet";

               ReportsPage page = new ReportsPage();
               dc.Content = page;

               pane.Items.Add(dc);
               dc.Focus();
        }
开发者ID:Joeeigel,项目名称:eve-net,代码行数:13,代码来源:WalletReportsPlugin.cs

示例6: BuildDockingLayout

        void BuildDockingLayout()
        {
            dockManager.Content = null;

            trv = new System.Windows.Controls.TreeView();
            TreeViewItem tvitem = GetTreeView("recorded_vid", "Recorded Video", @"C:\Users\UA\Documents\Project\Displayer\P001DS004Tvs2012\Icon\Video Call-50.png");
            trv.Items.Add(tvitem);
            foreach(var video in dbController.list_video()){
                ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = video });
            }
            trv.MouseDoubleClick += trv_NodeMouseDoubleClick;

            var treeviewContent_right = new DockableContent() { Title = "Video Lists", Content = trv };
            treeviewContent_right.Show(dockManager, AnchorStyle.Right);

            var treeviewContent_left = new DockableContent() { Title = "Device Lists", Content = new System.Windows.Controls.TextBox() { Text = "Device Lists", IsReadOnly = true } };
            treeviewContent_left.Show(dockManager, AnchorStyle.Left);
            treeviewContent_left.ToggleAutoHide();

            videoPanel.ShowAsDocument(dockManager);
        }
开发者ID:potmadu,项目名称:P001DS004Tvs2012,代码行数:21,代码来源:MainWindow.xaml.cs

示例7: DockableFloatingWindow

        public DockableFloatingWindow(DockingManager manager, DockableContent content)
            : this(manager)
        {

            //create a new temporary pane
            FloatingDockablePane pane = new FloatingDockablePane(this);

            //setup window size
            //Width = content.ContainerPane.ActualWidth;
            //Height = content.ContainerPane.ActualHeight;

            if (content.FloatingWindowSize.IsEmpty)
                content.FloatingWindowSize = new Size(content.ContainerPane.ActualWidth, content.ContainerPane.ActualHeight);
            
            Width = content.FloatingWindowSize.Width;
            Height = content.FloatingWindowSize.Height;

            //save current content position in container pane
            _previousPane = content.ContainerPane;
            _arrayIndexPreviousPane = _previousPane.Items.IndexOf(content);
            
            pane.Style = content.ContainerPane.Style;

            //remove content from container pane
            content.ContainerPane.RemoveContent(_arrayIndexPreviousPane);
            
            //add content to my temporary pane
            pane.Items.Add(content);

            //let templates access this pane
            HostedPane = pane;

            //Change state on contents
            IsDockableWindow = true;

            DocumentPane originalDocumentPane = _previousPane as DocumentPane;
            if (originalDocumentPane != null)
                originalDocumentPane.CheckContentsEmpty();
        }
开发者ID:Reticulatas,项目名称:AvalonDock,代码行数:39,代码来源:DockableFloatingWindow.cs

示例8: Show

        /// <summary>
        /// Show a dockable content in its container with a desidered state
        /// </summary>
        /// <param name="content">Content to show</param>
        /// <param name="desideredState">State desidered</param>
        /// <param name="desideredAnchor">Border to which anchor the newly created container pane</param>
        /// <remarks></remarks>
        internal void Show(DockableContent content, DockableContentState desideredState, AnchorStyle desideredAnchor)
        {
            Debug.WriteLine(string.Format("Show Content={0}, desideredState={1}, desideredAnchor={2}", content.Name, desideredState, desideredAnchor));

            #region Dockable content

            if (desideredState == DockableContentState.Hidden)//??!!show hidden?
                Hide(content);

            if (content.State == DockableContentState.AutoHide)
            {
                //first redock the content
                (content.ContainerPane as DockablePane).ToggleAutoHide();
                //then show it as desidered
                Show(content, desideredState, desideredAnchor);
            }
            else if (content.State == DockableContentState.Docked ||
                content.State == DockableContentState.Document ||
                content.State == DockableContentState.None)
            {
                if (content.ContainerPane == null ||
                    content.State == DockableContentState.None)
                {
                    //Problem!? try to rescue
                    if (content.State == DockableContentState.Docked ||
                        content.State == DockableContentState.None)
                    {
                        //find the the pane which the desidered anchor style
                        //DockablePane foundPane = this.FindChildDockablePane(desideredAnchor != AnchorStyle.None ? desideredAnchor : AnchorStyle.Right);
                        //first search for a pane with other contents (avoiding empty panes which are containers for hidden contents)
                        ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked);

                        if (itemFound == null)//search for all panes (even empty)
                            itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0);

                        DockablePane foundPane = itemFound != null ? itemFound.Item as DockablePane : null;

                        if (foundPane != null)
                        {
                            content.SetStateToDock();
                            foundPane.Items.Add(content);
                            var containerPanel = foundPane.Parent as ResizingPanel;
                            if (containerPanel != null)
                                containerPanel.InvalidateMeasure();
                        }
                        else
                        {
                            //if no suitable pane was found create e new one on the fly
                            if (content.ContainerPane != null)
                            {
                                content.ContainerPane.RemoveContent(content);
                            }

                            DockablePane pane = new DockablePane();
                            pane.Items.Add(content);
                            Anchor(pane, desideredAnchor);
                        }
                    }
                    else
                    {
                        //add to main document pane
                        MainDocumentPane.Items.Add(content);
                    }

                }

                if (content.ContainerPane.GetManager() == null)
                {
                    //disconnect the parent pane from previous panel
                    //((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
                    if (content.ContainerPane.Parent != null)
                    {
                        ((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
                    }

                    Anchor(content.ContainerPane as DockablePane, desideredAnchor);
                }

                if (desideredState == DockableContentState.DockableWindow ||
                     desideredState == DockableContentState.FloatingWindow)
                {
                    var floatingWindow = new DockableFloatingWindow(this);
                    floatingWindow.Content = content;

                    var mainWindow = Window.GetWindow(this);
                    if (mainWindow.IsVisible)
                        floatingWindow.Owner = mainWindow;

                    //floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    //if (content.Content != null)
                    //{
                    //    floatingWindow.Width = Math.Min(((FrameworkElement)content.Content).ActualWidth, ResizingPanel.GetResizeWidth(content.ContainerPane));
                    //    floatingWindow.Height = Math.Min(((FrameworkElement)content.Content).ActualHeight, ResizingPanel.GetResizeHeight(content.ContainerPane));
//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs

示例9: Hide

        /// <summary>
        /// Hide a dockable content removing it from its container <see cref="Pane"/>
        /// </summary>
        /// <param name="content">Content to hide</param>
        /// <remarks>Note that if you simply remove a content from its container without calling this method, the
        /// layout serializer component can't managed correctly the removed content.</remarks>
        internal void Hide(DockableContent content)
        {
            if (content.State == DockableContentState.Hidden)
            {
                DockableContents.Add(content);
                return;
            }

            if (!content.IsCloseable)
                return;

            if (content.State != DockableContentState.FloatingWindow &&
                content.State != DockableContentState.DockableWindow)
            {
                //save position only if hiding from a docked or autohidden pane
                content.SaveCurrentStateAndPosition();
            }

            if (content.State == DockableContentState.AutoHide)
            {
                HideFlyoutWindow();
                RemoveContentFromTabGroup(content);
            }

            if (content.State == DockableContentState.FloatingWindow ||
                content.State == DockableContentState.DockableWindow)
            {
                DockableFloatingWindow floatingWindow = Window.GetWindow(content) as DockableFloatingWindow;

                if (floatingWindow != null &&
                    (floatingWindow.Content as Pane).HasSingleItem &&
                    !floatingWindow.IsClosing)
                {
                    floatingWindow.Close();
                }
            }

            if (content.State != DockableContentState.Hidden)
            {
                DockableContents.Add(content);

                content.SetStateToHidden();
                content.DetachFromContainerPane();
            }

            if (ActiveDocument == content)
                ActiveDocument = null;

            if (ActiveContent == content)
                ActiveContent = null;
        }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:57,代码来源:DockingManager.cs

示例10: Drag

 internal void Drag(DockableContent dockableContent, Point point, Point offset)
 {
     if (CaptureMouse())
     {
         var floatingWindow = new DockableFloatingWindow(this);
         floatingWindow.Content = dockableContent;
         floatingWindow.Owner = Window.GetWindow(this);
         Drag(floatingWindow, point, offset);
     }
 }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:10,代码来源:DockingManager.cs

示例11: switch


//.........这里部分代码省略.........
     this.DrawPolygonBtn.Checked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Checked);
     
     #line default
     #line hidden
     
     #line 60 "..\..\..\MainWindow.xaml"
     this.DrawPolygonBtn.Unchecked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Unchecked);
     
     #line default
     #line hidden
     return;
     case 32:
     this.RibbonDlgMgrGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target));
     return;
     case 33:
     this.ToggleDlgBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 66 "..\..\..\MainWindow.xaml"
     this.ToggleDlgBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleDlgBtn_Click);
     
     #line default
     #line hidden
     return;
     case 34:
     this.RibbonSpeechRecGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target));
     return;
     case 35:
     this.ToggleSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 69 "..\..\..\MainWindow.xaml"
     this.ToggleSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleSpeechBtn_Click);
     
     #line default
     #line hidden
     return;
     case 36:
     this.SimSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 70 "..\..\..\MainWindow.xaml"
     this.SimSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.SimSpeechBtn_Click);
     
     #line default
     #line hidden
     return;
     case 37:
     this.dockManager = ((AvalonDock.DockingManager)(target));
     return;
     case 38:
     this.LayersPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 39:
     this.tocGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 40:
     
     #line 84 "..\..\..\MainWindow.xaml"
     ((AvalonDock.DocumentPane)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DocumentPane_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 41:
     this.MapPanel = ((AvalonDock.DocumentContent)(target));
     return;
     case 42:
     this.mapGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 43:
     this.LayoutPanel = ((AvalonDock.DocumentContent)(target));
     return;
     case 44:
     this.layoutGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 45:
     this.KinectCtrlPanel = ((AvalonDock.DockablePane)(target));
     return;
     case 46:
     this.ColorDisplayPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 47:
     this.colorDisplay = ((System.Windows.Controls.Image)(target));
     return;
     case 48:
     this.skeletonCanvas = ((System.Windows.Controls.Canvas)(target));
     return;
     case 49:
     this.DepthDisplayPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 50:
     this.depthDisplay = ((System.Windows.Controls.Image)(target));
     return;
     case 51:
     this.DevCtrlPanel = ((AvalonDock.DockablePane)(target));
     return;
     case 52:
     this.statusTB = ((System.Windows.Controls.TextBlock)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:cdbean,项目名称:CAGA,代码行数:101,代码来源:MainWindow.g.i.cs

示例12: AddDockablePane

 /// <summary>
 /// Adds a new side menu window
 /// </summary>
 /// <param name="title">The title of the side menu.</param>
 /// <param name="control">The control that will be inserted into the side menu.</param>
 public void AddDockablePane(string title, UserControl control)
 {
     var dockable = new DockableContent()
     {
         Title = title,
         Content = control,
         IsCloseable = false,
         DockableStyle = DockableStyle.AutoHide,
     };
     dockable.Show(this.dockManger);
 }
开发者ID:seniorOtaka,项目名称:ndoctor,代码行数:16,代码来源:MainWindow.xaml.cs

示例13: RestoreResizingPanel

        ResizingPanel RestoreResizingPanel(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments, ref DocumentPane mainDocumentPane)
        {
            ResizingPanel panel = null;

            if (mainElement.Name == "DocumentPaneResizingPanel")
                panel = new DocumentPaneResizingPanel();
            else
                panel = new ResizingPanel();

            if (mainElement.HasAttribute("Orientation"))
                panel.Orientation = (Orientation)Enum.Parse(typeof(Orientation), mainElement.GetAttribute("Orientation"));
            if (mainElement.HasAttribute("ResizeWidth"))
                ResizingPanel.SetResizeWidth(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth")));
            if (mainElement.HasAttribute("ResizeHeight"))
                ResizingPanel.SetResizeHeight(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight")));
            if (mainElement.HasAttribute("EffectiveSize"))
                ResizingPanel.SetEffectiveSize(panel, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize")));

            foreach (XmlElement childElement in mainElement.ChildNodes)
            {
                if (childElement.Name == "ResizingPanel" ||
                    childElement.Name == "DocumentPaneResizingPanel")
                {
                    var childPanel = RestoreResizingPanel(childElement, actualContents, actualDocuments, ref mainDocumentPane);

                    if (childPanel.Children.Count > 0)
                    {
                        panel.Children.Add(childPanel);
                    }
                    else
                    {
                        Debug.WriteLine("Found empty ResizingPanel in stored layout, it will be discarded.");
                    }
                }
                #region Restore DockablePane
                else if (childElement.Name == "DockablePane")
                {
                    var pane = RestoreDockablePaneLayout(childElement, actualContents, actualDocuments);

                    //restore dockable panes even if no contents are inside (an hidden content could refer this pane in SaveStateAndPosition)
                    panel.Children.Add(pane);

                }
                #endregion
                #region Restore Contents inside a DocumentPane
                else if (childElement.Name == "DocumentPane")
                {
                    var documentPane = RestoreDocumentPaneLayout(childElement, actualContents, actualDocuments);

                    bool isMainDocumentPane = false;
                    if (childElement.HasAttribute("IsMain"))
                        isMainDocumentPane = XmlConvert.ToBoolean(childElement.GetAttribute("IsMain"));

                    if (documentPane.Items.Count > 0 ||
                        isMainDocumentPane)
                        panel.Children.Add(documentPane);

                    if (isMainDocumentPane)
                    {
                        if (mainDocumentPane != null)
                            throw new InvalidOperationException("Main document pane is set more than one time");

                        mainDocumentPane = documentPane;
                    }
                }

                #endregion
            }

            return panel;
        }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:71,代码来源:DockingManager.cs

示例14: RestoreDocumentPaneLayout

        ///// <summary>
        ///// Restore from xml a document pane
        ///// </summary>
        ///// <param name="childElement"></param>
        ///// <param name="mainExistingDocumentPane"></param>
        ///// <param name="existingDocumentPanel"></param>
        ///// <param name="dockableContents"></param>
        //void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents)
        //{
        //    mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel);
        //    if (mainExistingDocumentPane != null)
        //    {
        //        existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel();
        //    }
        //    else
        //    {
        //        existingDocumentPanel = null;
        //    }
        //    if (existingDocumentPanel != null)
        //    {
        //        if (existingDocumentPanel.Parent is ResizingPanel)
        //        {
        //            ((ResizingPanel)existingDocumentPanel.Parent).RemoveChild(existingDocumentPanel);
        //        }
        //        else if (existingDocumentPanel.Parent is DockingManager)
        //        {
        //            ((DockingManager)existingDocumentPanel.Parent).Content = null;
        //        }
        //    }
        //    else if (mainExistingDocumentPane != null)
        //    {
        //        if (mainExistingDocumentPane.Parent is ResizingPanel)
        //        {
        //            ((ResizingPanel)mainExistingDocumentPane.Parent).RemoveChild(mainExistingDocumentPane);
        //        }
        //        else if (mainExistingDocumentPane.Parent is DockingManager)
        //        {
        //            ((DockingManager)mainExistingDocumentPane.Parent).Content = null;
        //        }
        //    }
        //    foreach (XmlElement contentElement in childElement.ChildNodes)
        //    {
        //        if (contentElement.HasAttribute("Name"))
        //        {
        //            DockableContent foundContent = null;
        //            string contentName = contentElement.GetAttribute("Name");
        //            foreach (DockableContent content in dockableContents)
        //            {
        //                if (content.Name == contentName)
        //                {
        //                    foundContent = content;
        //                    break;
        //                }
        //            }
        //            if (foundContent == null &&
        //                DeserializationCallback != null)
        //            {
        //                DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
        //                DeserializationCallback(this, e);
        //                foundContent = e.Content as DockableContent;
        //            }
        //            if (foundContent != null)
        //            {
        //                DetachContentFromDockingManager(foundContent);
        //                mainExistingDocumentPane.Items.Add(foundContent);
        //                foundContent.SetStateToDocument();
        //                //call custom layout persistence method
        //                foundContent.RestoreLayout(contentElement);
        //            }
        //        }
        //    }
        //}
        DocumentPane RestoreDocumentPaneLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments)
        {
            var documentPane = new DocumentPane();

            if (mainElement.HasAttribute("ResizeWidth"))
                ResizingPanel.SetResizeWidth(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth")));
            if (mainElement.HasAttribute("ResizeHeight"))
                ResizingPanel.SetResizeHeight(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight")));
            if (mainElement.HasAttribute("EffectiveSize"))
                ResizingPanel.SetEffectiveSize(documentPane, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize")));

            foreach (XmlElement contentElement in mainElement.ChildNodes)
            {
                if (contentElement.Name == "DockableContent" &&
                                            contentElement.HasAttribute("Name"))
                {
                    DockableContent foundContent = null;
                    string contentName = contentElement.GetAttribute("Name");

                    foundContent = actualContents.FirstOrDefault(c => c.Name == contentName);

                    if (foundContent == null &&
                        DeserializationCallback != null)
                    {
                        DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
                        DeserializationCallback(this, e);

                        foundContent = e.Content as DockableContent;
//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs

示例15: RemoveContentFromTabGroup

        bool RemoveContentFromTabGroup(DockableContent contentToRemove)
        {
            foreach (Panel anchorTabPanel in _anchorTabPanels)
            {
                foreach (DockablePaneAnchorTabGroup group in anchorTabPanel.Children)
                {
                    foreach (DockablePaneAnchorTab tab in group.Children)
                    {
                        if (tab.ReferencedContent == contentToRemove)
                        {
                            group.Children.Remove(tab);
                            if (group.Children.Count == 0)
                                anchorTabPanel.Children.Remove(group);

                            return true;
                        }
                    }
                }
            }

            return false;
        }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:22,代码来源:DockingManager.cs


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