Back to Devexpress

IDockController.AddDocumentPanel(DocumentGroup, Uri) Method

wpf-devexpress-dot-xpf-dot-docking-dot-idockcontroller-dot-adddocumentpanel-x28-devexpress-dot-xpf-dot-docking-dot-documentgroup-system-dot-uri-x29.md

latest4.4 KB
Original Source

IDockController.AddDocumentPanel(DocumentGroup, Uri) Method

Adds a new DocumentPanel to the specified DocumentGroup and loads the contents of a Window, Page or UserControl defined in the specified XAML into the DocumentPanel.

Namespace : DevExpress.Xpf.Docking

Assembly : DevExpress.Xpf.Docking.v25.2.dll

NuGet Package : DevExpress.Wpf.Docking

Declaration

csharp
DocumentPanel AddDocumentPanel(
    DocumentGroup group,
    Uri uri
)
vb
Function AddDocumentPanel(
    group As DocumentGroup,
    uri As Uri
) As DocumentPanel

Parameters

NameTypeDescription
groupDocumentGroup

A DocumentGroup object to which a new DocumentPanel is added.

| | uri | Uri |

The uniform resource identifier (URI) of the XAML that defines a Window, Page or UserControl to be loaded into the created DocumentPanel.

|

Returns

TypeDescription
DocumentPanel

The created DocumentPanel object.

|

Remarks

When the URI refers to a Window or Page, the AddDocumentPanel method loads the contents of the specified Window/Page. The Window/Page objects themselves, and their resources and event handlers are not loaded, and they will not be available from the inherited LayoutPanel.Control property.

When the URI refers to a UserControl, the UserControl itself is loaded. Use the inherited LayoutPanel.Control property to access the loaded UserControl.

Note

The XAML file load is delegated to the Application.LoadComponent method.

Example

The following code adds a new DocumentPanel object to a DocumentGroup, and loads the content of the “ChildPage.xaml” into this panel:

csharp
DocumentPanel panel = dockLayoutManager1.DockController.AddDocumentPanel(
    documentGroup1, new Uri(@"Layouts\ChildPage.xaml", UriKind.Relative));
panel.Caption = "Page 1";

View Example: How To Load An External Window Or UserControl Into a DocumentPanel

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddDocumentPanel(DocumentGroup, Uri) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-docklayoutmanager-load-an-external-window-or-usercontrol-into-a-documentpanel/CS/DocumentPanel_Content/MainWindow.xaml.cs#L25

csharp
private void btnAddDockPanel_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
    panel1 = dockLayoutManager1.DockController.AddDocumentPanel(documentGroup1,
        new Uri(@"CustomWindows\UserControl1.xaml", UriKind.Relative));

See Also

Control

Uri

IDockController Interface

IDockController Members

DevExpress.Xpf.Docking Namespace