'宣言 Public Class XamDockManager Inherits System.Windows.Controls.ContentControl
public class XamDockManager : System.Windows.Controls.ContentControl
Imports Infragistics.Windows.DockManager Private Sub InitializeDockManager(ByVal dockManager As XamDockManager) ' Left dock area with unpinned pane and pinned pane Dim splitLeft As New SplitPane() XamDockManager.SetInitialLocation(splitLeft, InitialPaneLocation.DockedLeft) splitLeft.SplitterOrientation = Orientation.Horizontal Dim cpLeftUnpinned As New ContentPane() cpLeftUnpinned.Header = "TreeView" cpLeftUnpinned.IsPinned = False cpLeftUnpinned.Content = New TreeView() splitLeft.Panes.Add(cpLeftUnpinned) Dim cpLeftPinned As New ContentPane() Dim tb As New CheckBox() tb.Content = "Toggle" cpLeftPinned.Header = "Toggle" cpLeftPinned.Content = tb splitLeft.Panes.Add(cpLeftPinned) ' Bottom dock area with vertical split Dim splitBottom As New SplitPane() XamDockManager.SetInitialLocation(splitBottom, InitialPaneLocation.DockedBottom) splitBottom.SplitterOrientation = Orientation.Vertical Dim cpBottomText As New ContentPane() cpBottomText.Header = "TextBox" cpBottomText.Content = New TextBox() splitBottom.Panes.Add(cpBottomText) Dim cpBottomList As New ContentPane() cpBottomList.Header = "ListView" cpBottomList.Content = New ListView() splitBottom.Panes.Add(cpBottomList) ' Floating dockable split pane Dim splitFloating As New SplitPane() XamDockManager.SetInitialLocation(splitFloating, InitialPaneLocation.DockableFloating) XamDockManager.SetFloatingLocation(splitFloating, New Point(100, 100)) XamDockManager.SetFloatingSize(splitFloating, New Size(350, 200)) Dim tgpFloating As New TabGroupPane() Dim cpRichText As New ContentPane() cpRichText.Header = "RichText" cpRichText.Content = New RichTextBox() tgpFloating.Items.Add(cpRichText) Dim cpCheck As New ContentPane() cpCheck.Header = "CheckBox" cpCheck.Content = New CheckBox() tgpFloating.Items.Add(cpCheck) splitFloating.Panes.Add(tgpFloating) ' note, the order in which the panes are defined/added ' affects their position within the dockmanager. those ' defined first will be positioned closer first and will ' be closer to the outer edge of the dockmanager dockManager.Panes.Add(splitLeft) dockManager.Panes.Add(splitBottom) dockManager.Panes.Add(splitFloating) ' XamDockManager is a ContentControl so the content can be ' anything but use a DocumentContentHost to include a VS ' like tabbed document interface that can participate in ' the docking Dim dch As New DocumentContentHost() ' a document content host contains 1 or more split panes Dim splitDch As New SplitPane() ' those split panes can only contain a tabgrouppane Dim tgpDch As New TabGroupPane() Dim cpText As New ContentPane() cpText.Header = "TextBox" cpText.Content = New TextBox() tgpDch.Items.Add(cpText) Dim cpButton As New ContentPane() Dim btnInDch As New Button() btnInDch.Content = "Button" cpButton.Header = "Button" cpButton.Content = btnInDch tgpDch.Items.Add(cpButton) splitDch.Panes.Add(tgpDch) dch.Panes.Add(splitDch) dockManager.Content = dch End Sub
using Infragistics.Windows.DockManager; private void InitializeDockManager(XamDockManager dockManager) { // Left dock area with unpinned pane and pinned pane SplitPane splitLeft = new SplitPane(); XamDockManager.SetInitialLocation(splitLeft, InitialPaneLocation.DockedLeft); splitLeft.SplitterOrientation = Orientation.Horizontal; ContentPane cpLeftUnpinned = new ContentPane(); cpLeftUnpinned.Header = "TreeView"; cpLeftUnpinned.IsPinned = false; cpLeftUnpinned.Content = new TreeView(); splitLeft.Panes.Add(cpLeftUnpinned); ContentPane cpLeftPinned = new ContentPane(); CheckBox tb = new CheckBox(); tb.Content = "Toggle"; cpLeftPinned.Header = "Toggle"; cpLeftPinned.Content = tb; splitLeft.Panes.Add(cpLeftPinned); // Bottom dock area with vertical split SplitPane splitBottom = new SplitPane(); XamDockManager.SetInitialLocation(splitBottom, InitialPaneLocation.DockedBottom); splitBottom.SplitterOrientation = Orientation.Vertical; ContentPane cpBottomText = new ContentPane(); cpBottomText.Header = "TextBox"; cpBottomText.Content = new TextBox(); splitBottom.Panes.Add(cpBottomText); ContentPane cpBottomList = new ContentPane(); cpBottomList.Header = "ListView"; cpBottomList.Content = new ListView(); splitBottom.Panes.Add(cpBottomList); // Floating dockable split pane SplitPane splitFloating = new SplitPane(); XamDockManager.SetInitialLocation(splitFloating, InitialPaneLocation.DockableFloating); XamDockManager.SetFloatingLocation(splitFloating, new Point(100, 100)); XamDockManager.SetFloatingSize(splitFloating, new Size(350, 200)); TabGroupPane tgpFloating = new TabGroupPane(); ContentPane cpRichText = new ContentPane(); cpRichText.Header = "RichText"; cpRichText.Content = new RichTextBox(); tgpFloating.Items.Add(cpRichText); ContentPane cpCheck = new ContentPane(); cpCheck.Header = "CheckBox"; cpCheck.Content = new CheckBox(); tgpFloating.Items.Add(cpCheck); splitFloating.Panes.Add(tgpFloating); // note, the order in which the panes are defined/added // affects their position within the dockmanager. those // defined first will be positioned closer first and will // be closer to the outer edge of the dockmanager dockManager.Panes.Add(splitLeft); dockManager.Panes.Add(splitBottom); dockManager.Panes.Add(splitFloating); // XamDockManager is a ContentControl so the content can be // anything but use a DocumentContentHost to include a VS // like tabbed document interface that can participate in // the docking DocumentContentHost dch = new DocumentContentHost(); // a document content host contains 1 or more split panes SplitPane splitDch = new SplitPane(); // those split panes can only contain a tabgrouppane TabGroupPane tgpDch = new TabGroupPane(); ContentPane cpText = new ContentPane(); cpText.Header = "TextBox"; cpText.Content = new TextBox(); tgpDch.Items.Add(cpText); ContentPane cpButton = new ContentPane(); Button btnInDch = new Button(); btnInDch.Content = "Button"; cpButton.Header = "Button"; cpButton.Content = btnInDch; tgpDch.Items.Add(cpButton); splitDch.Panes.Add(tgpDch); dch.Panes.Add(splitDch); dockManager.Content = dch; }