You can define a Window, Page, or UserControl in external XAML files and load their contents into DocumentPanel objects.
This example loads an external Window and UserControl into DocumentPanels in three ways:
-
Use the DocumentPanel.Content inherited property to load the content of MyWindow.xaml into a DocumentPanel at design time (in XAML). The Content property accepts an Uri object that is linked to a XAML file and defines a Window, Page, or UserControl.
<dxdo:DocumentPanel x:Name="docPanel2" Caption="Panel 2" Content="{dxdo:RelativeUri UriString=CustomWindows\\MyWindow.xaml}"/>
-
The DocumentPanel.Content property is set with a Uri object at runtime:
docPanel1.Content = new Uri(@"CustomWindows\MyWindow1.xaml", UriKind.Relative);
-
Call the DockLayoutManager.DockController's AddPanel method to create a new DocumentPanel object and load the contents of an external XAML file into the created panel.
panel1 = dockLayoutManager1.DockController.AddDocumentPanel(documentGroup1, new Uri(@"CustomWindows\UserControl1.xaml", UriKind.Relative)); panel1.Caption = "Document " + (ctr++).ToString();
In the example, the XAML file defines a UserControl object. The example's code uses the DocumentPanel's Control inherited property to access the loaded UserControl, and then invokes the UserControl's method:
//...
(panel1.Control as UserControl1).SetDataContext(imageInfo);
In the example, you can the Set DataContext for UserControl button to see this in action.
- WPF Dock Layout Manager - Create a Simple Layout of Dock Panes
- WPF Dock Layout Manager - Create a Complex Layout of Dock Panels
- WPF Dock Layout Manager - Сreate a DocumentGroup with Two Tabs
- WPF Dock Layout Manager - Create Tabbed and Document Groups
(you will be redirected to DevExpress.com to submit your response)